This discussion is archived
2 Replies Latest reply: Nov 22, 2012 2:42 AM by 975552 RSS

WebView not rendering correct when pages have jquery

975552 Newbie
Currently Being Moderated
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
    jsmith Guru
    Currently Being Moderated
    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:

    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:
  • 2. Re: WebView not rendering correct when pages have jquery
    975552 Newbie
    Currently Being Moderated

    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 , 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(
         at javafx.scene.web.WebEngine.executeScript(
         at dtn.jcustomer.SwingFXWebView$3$
         at com.sun.javafx.application.PlatformImpl$
         at Method)

    * 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();




  • Correct Answers - 10 points
  • Helpful Answers - 5 points