JavaFx WebView does NOT support window.onbeforeunload=true. In All other major browsers, doing this will ask the user whether they want to leave or not (they probably have unsaved changes).
Since the applet will be no longer supported, we ���Oracle) have suggested that sites use webstart to startup a WebView and overlay the java ontop.
Our suctomers can't do this successfully without having support for window.onbeforeunload=true since our HTML pages rely on that feature.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try this jsfiddle in a WebView, when attempting to leave the the page in all major browsers, you will be given some sort of confirm action dialog:
https://jsfiddle.net/zalun/yFuPr/
Here is the javascript to reproduce yourself on a WebView:
window.onbeforeunload = function(e) {
e = e || window.event;
e.preventDefault = true;
e.cancelBubble = true;
e.returnValue = 'test';
}
Expected Behavior:
confirmation dialog on attempt to re-navigate browser
ACTUAL -
no confirmation dialog, unsaved changes will be lost
Reproducing test program is attached.