Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 7u45
    • Fix Version/s: tbd
    • Component/s: javafx
    • Labels:
    • Environment:

      Window 8, JDK 8 b116.

    • Subcomponent:
      web

      Description

      At the moment Nashorn API (http://download.java.net/jdk8/docs/technotes/guides/scripting/nashorn/api.html) is not available in a WebView. A try to run this:

          System.out.println(browser.getEngine().executeScript("Java.type(\"java.lang.Math\").PI"));


      Would lead to JSException:

      netscape.javascript.JSException: ReferenceError: Can't find variable: Java
      at com.sun.webkit.dom.JSObject.fwkMakeException(JSObject.java:128)
      at com.sun.webkit.WebPage.twkExecuteScript(Native Method)
      at com.sun.webkit.WebPage.executeScript(WebPage.java:1410)
      at javafx.scene.web.WebEngine.executeScript(WebEngine.java:934)

      Adding Nashorn API would simplify running Java code in a WebView and make easier the development of desktop applications using JavaScript frameworks like AngularJS, Twitter Bootstrap, PhoneGap, etc. Though it is possible at the moment, it requires adding boilerplate code and JavaScript-to-Java call workarounds, i.e. serializing complex objects to JSON.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              achaschevjfx Andrey Chaschev (Inactive)
            • Votes:
              4 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported: