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

WebView. "onclick" attribute in HTML not working on Windows with Java 8u111.

    Details

    • Subcomponent:
      web
    • CPU:
      x86_64
    • OS:
      windows_7

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_111"
      Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
      Java HotSpot(TM) Client VM (build 25.111-b14, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      WebView. "onclick" attribute in HTML not working on Windows with Java 8u111.

      REGRESSION. Last worked in version 8u101

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.8.0_101"
      Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run attached code.
      Click on "Click me" button.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Message dialog is shown.
      ACTUAL -
      Nothing happens.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.web.WebEngine;
      import javafx.scene.web.WebView;
      import javafx.stage.Stage;
      import netscape.javascript.JSObject;

      import javax.swing.JOptionPane;

      public class WebViewTest extends Application {

          @Override
          public void start(Stage primaryStage) throws Exception {
              Stage stage = new Stage();
              stage.setTitle("WebViewTest");
              WebView webView = new WebView();
              stage.setScene(new Scene(webView, 400, 300));
              WebEngine webEngine = webView.getEngine();
              stage.show();
              webEngine.loadContent("<!DOCTYPE html>\n" +
                      "<html>" +
                      "<body>" +
                      "<p><a href=\"#\" onclick=\"java.alert('Click handled')\">Click me</a><p>" +
                      "</body>" +
                      "</html>");
              JSObject window = (JSObject) webEngine.executeScript("window");
              window.setMember("java", new Java());
          }

          public class Java {

              public void alert(String string) {
                  JOptionPane.showMessageDialog(null, string);
              }
          }
      }

      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mbilla Murali Billa
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: