2 Replies Latest reply on Nov 22, 2012 10:42 AM by baze985

    WebView not rendering correct when pages have jquery

      Hi all,

      I use the webview from javafx last version(2.2.3) bundled with jdk7. All works ok on a pages that use native(vanilla) js, but on a pages
      that use jquery I see problems (some feature work some not).

      Any idea-experience somebody?!

      I used the very basic example from the documantation, and I just point to a page which uses jquery 1.7.3...

        • 1. Re: WebView not rendering correct when pages have jquery
          I just point to a page which uses jquery 1.7.3
          There is no such thing. The latest jquery version on the 1.7 branch is 1.7.2 - see the past release list at: http://jquery.com/download/?rdfrom=http%3A%2F%2Fdocs.jquery.com%2Fmw%2Findex.php%3Ftitle%3DDownloading_jQuery%26redirect%3Dno

          In my usage, jquery has worked fine with WebView.

          You can try it out here by running the gist and clicking on links (which jQuery will hide):
          Re: Can I embed jQuery into JavaFX WebEngine?

          If there is specific functionality in JQuery which is not working, you could post steps to reproduce it in another forum post or create a bug request: https://forums.oracle.com/forums/ann.jspa?annID=1713
          • 2. Re: WebView not rendering correct when pages have jquery

            sorry for the version was a typo..its ofcourse 1.7.2!

            Like I said some of the features are not working. I still can not narrow down to what exactly,
            Ill will do more checking and write here again.

            Here is the example class i use:

            its pointing to https://www.softwaredemo.de , the navigation uses jquery to show dropdown lists (this all works on a normal browser)
            but in the webview is not working. I also found problems on other pages using jquery, I can post more if you need...

            Interesting is that if we use the toggle button to execute a jquery script which hides or shows the body...
            somethimes its working sometimes not,
            just throws a TypeError:

            netscape.javascript.JSException: TypeError: 'undefined' is not a function
                 at com.sun.webpane.platform.WebPage.twkExecuteScript(Native Method)
                 at com.sun.webpane.platform.WebPage.executeScript(WebPage.java:1438)
                 at javafx.scene.web.WebEngine.executeScript(WebEngine.java:811)
                 at dtn.jcustomer.SwingFXWebView$3$1.run(SwingFXWebView.java:96)
                 at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:173)
                 at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
                 at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
                 at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
                 at java.lang.Thread.run(Thread.java:722)

            * SwingFXWebView
            public class SwingFXWebView extends JPanel {

            private WebView browser;
            private JFXPanel jfxPanel;

            public SwingFXWebView() {

            public static void main(String... args) {

            SwingUtilities.invokeLater(new Runnable() {
            public void run() {
            final JFrame frame = new JFrame();
            frame.setName("JavaFX web view");
            SwingFXWebView p = new SwingFXWebView();

            frame.setMinimumSize(new Dimension(640, 480));
            // p.createScene();

            private void initComponents() {

            jfxPanel = new JFXPanel();

            swingButton = new JButton();
            swingButton.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
            PlatformImpl.startup(new Runnable() {
            public void run() {
            browser.getEngine().executeScript( "if( $('body').is(':visible') ) { " +
            " $('body').hide('slow'); } else {" +
            " $('body').show('slow'); }");

            browser.getEngine().executeScript( "$(\"a\").click(function(event){" +
            " event.preventDefault();" +
            " $(this).hide(\"slow\");" +

            swingButton.setText("toggle Visible");


            * createScene
            private void createScene() {
            PlatformImpl.startup(new Runnable() {
            public void run() {
            BorderPane pane = new BorderPane();
            Scene scene = new Scene(pane);

            browser = new WebView();