Possibly related to How to open mailto link in Chrome with Window.open without creating a new tab?
Hi all. I have a form page where i\'ve put a window.onbeforeunload co
Add a flag and see if it is flipped, set the flag on the link click.
var ignore = false
window.onbeforeunload = function() {
if (changed && !ignore) {
return "You have unsaved changes. Do you really want to leave this page without saving?";
} else {
ignore = false;
}
}
And the link
<a class="button button-alt" href="mailto:foo@foo.com" onclick="ignore=true">Report a problem</a>
It would be better to add the onclick with JavaScript code.