Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8160749

WebView does not support window.onbeforeunload

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • 8u66, 9
    • javafx
    • None
    • web
    • x86
    • windows_8

      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.

            Unassigned Unassigned
            gucheng Guixin Cheng
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: