As far as I know, window.location does exactly what you are looking for, triggering the browser's default link clicking behavior.
Some browsers notice the protocol before any events are fired or the actual href is changed.
window.location = "mailto:somebody@example.com";
Trying the fiddle demo mentioned below I get the following results:
onbeforeunload
with the button and linkonbeforeunload
only for the buttononbeforeunload
So a good way to prevent the unload
event from being fired is by returning false in beforeunload
.