You can rewrite the open method, which adds the beforeunload event. Look at the annotated code + bookmarklet below:
the code:
javascript:(function(w){ var o = w.open; w.open = function() { var x = o.apply(w, arguments); x.addEventListener('beforeunload',function(e){e.preventDefault()},true); return x; } })(window);
Bookmarklet:
javascript:(function(w){var o=w.open;w.open=function(){var x=o.apply(w,arguments);x.addEventListener('beforeunload',function(e){e.preventDefault()},true);return x;}})(window);
Rob w source share