title: JavaFX not working properly with Internet Exploer 9 and 10 ( if Document mode is set to IE9 )
body: <p>I faced a problem in depolying JavaFX app in web and I got issue only with IE10 or IE9 and to be more precisely  when the Document Mode is 9 , issue is that Browser cannot recognize the object 'app' which will be defined by JavaFx after being loaded . This object 'app' calls  function  'tellme' with parameters. What I expect to see log on browser console: "____a OK maher", but what I get is an error message: </p>
  
  <pre><code>SCRIPT438: Object doesn't support property or method 'tellme' 
  </code></pre>
  
  <p>Other info: </p>
  
  <ul>
  <li>after launching Java there is prompt about publisher, permissions, see Image#1</li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/AmL6d.png" alt="enter image description here"></p>
  
  <p>just accept and go on.</p>
  
  <ul>
  <li>Website requests access and control over JavaFx app ( there is JS &lt;==> JavaFX ) and so there is a security warning about that and requests user to allow. see Image #2</li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/4FYmu.png" alt="enter image description here"></p>
  
  <p>Here I noted that in Document Mode IE9 I got this warning immediately after first one ..but on other browsers ( including DM IE8,DM IE7 ) its appearing after pressing clicl that means after calling JavaFx from JS via app.tellme</p>
  
  <ul>
  <li><p>Again Issue only with IE, with other browser its OK ( Chrome, Opera, FF,.. etc ) also no issue with  earlier versions of IE  7 and 8  ; briefly I have the problem only if IE document mode is set to IE9  </p></li>
  <li><p>This has nothing with Signing .. I have a valid sign code cert ..and surely I set correct permissions on manifest ( codebase, permissions, ...etc) but really this has nothing with this issue .. only 2nd warning disappears but issue still persists.</p></li>
  <li><p>To simulate the issue:</p>
  
  <p>1-Open main.html (codes below) with IE9 or IE10, press F12 to set Document Mode to IE 9.</p>
  
  <p>2-press start, and accept to run that app, then accept the following prompt to allow accessing 
   JavaFx via JS.</p>
  
  <p>3-press clicl, on browser console you will see the error message .. what I expected to solve this issue to see output :"____a OK maher"</p></li>
  </ul>
  
  <p>codes:</p>
  
  <p>main.java ( JavaFX app) :<strong>updated</strong></p>
  
  <pre><code>/*
   * To change this template, choose Tools | Templates
   * and open the template in the editor.
   */
  package org.im.oor;
  
  import javafx.application.Application;
  import javafx.event.ActionEvent;
  import javafx.event.EventHandler;
  import javafx.scene.Scene;
  import javafx.scene.control.Button;
  import javafx.scene.layout.StackPane;
  import javafx.stage.Stage;
  import netscape.javascript.JSObject;
  
  /**
   *
   * @author maher
   */
  public class Main extends Application {
  
      @Override
      public void start(Stage primaryStage) {
  
  
  
          Button btn = new Button();
          btn.setText("Say 'Hello World'");
          btn.setOnAction(new EventHandler&lt;ActionEvent&gt;() {
              @Override
              public void handle(ActionEvent event) {
                  System.out.println("Hello World!");
              }
          });
  
          StackPane root = new StackPane();
          root.getChildren().add(btn);
  
          Scene scene = new Scene(root, 300, 250);
          publishServices();
          primaryStage.setTitle("Hello World!");
          primaryStage.setScene(scene);
          primaryStage.show();
      }
  
  
  
      private static JSObject jsWin;
  
      private void publishServices() {
  
          try {
  
  
          JSObject jsWins = getHostServices().getWebContext();
  
          jsWins.setMember("app", new JavaAplicationCallBack());
  
          } catch (Exception e) {
              System.err.println("error with JSObject : "+e.getMessage());
          }
      }
  
      public class JavaAplicationCallBack {
  
          public String tellme(String uu) {
              return "OK " + uu;
  
          }
      }
  
      /**
       * The main() method is ignored in correctly deployed JavaFX application.
       * main() serves only as fallback in case the application can not be
       * launched through deployment artifacts, e.g., in IDEs with limited FX
       * support. NetBeans ignores main().
       *
       * @param args the command line arguments
       */
      public static void main(String[] args) {
          launch(args);
      }
  }
  </code></pre>
  
  <p>main.html (webpage):<strong>updated</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;!--&lt;meta http-equiv="X-UA-Compatible" content="IE=8"&gt;--&gt;
          &lt;script src="web-files/dtjava.js"  type="text/javascript" &gt;&lt;/script&gt;
          &lt;script src="jfx.js"  type="text/javascript" &gt;&lt;/script&gt;
          &lt;script src="http://code.jquery.com/jquery-1.7.min.js"&gt;
          &lt;/script&gt;
          &lt;script&gt;
              $(document).ready(function() {
                  $("a.ll").live("click", function(event) {
                      callit('hi ');
                  });
              });
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;a href="#" onclick="launchit();" &gt;start&lt;/a&gt;
          &lt;a class='ll' href="#"  &gt;clicl&lt;/a&gt;
          &lt;!-- Applet will be inserted here --&gt;
          &lt;div id='javafx-app-placeholder'&gt;&lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>jfx.js ( javascript used on main.html ):<strong>updated</strong></p>
  
  <pre><code>function javafxEmbed() {
      dtjava.embed(
              {
                  url : 'TestIdleCallJavaFx.jnlp',
                  //url: 'Testjfx.jnlp',
                  placeholder: 'javafx-app-placeholder',
                  width: 300,
                  height: 100,
                  jnlp_content: 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxqbmxwIHNwZWM9IjEuMCIgeG1sbnM6amZ4PSJodHRwOi8vamF2YWZ4LmNvbSIgaHJlZj0iVGVzdElkbGVDYWxsSmF2YUZ4LmpubHAiPg0KICA8aW5mb3JtYXRpb24+DQogICAgPHRpdGxlPlRlc3RJZGxlQ2FsbEphdmFGeDwvdGl0bGU+DQogICAgPHZlbmRvcj5NYWhlcjwvdmVuZG9yPg0KICAgIDxkZXNjcmlwdGlvbj5TYW1wbGUgSmF2YUZYIDIuMCBhcHBsaWNhdGlvbi48L2Rlc2NyaXB0aW9uPg0KICAgIDxvZmZsaW5lLWFsbG93ZWQvPg0KICA8L2luZm9ybWF0aW9uPg0KICA8cmVzb3VyY2VzPg0KICAgIDxqZng6amF2YWZ4LXJ1bnRpbWUgdmVyc2lvbj0iMi4yKyIgaHJlZj0iaHR0cDovL2phdmFkbC5zdW4uY29tL3dlYmFwcHMvZG93bmxvYWQvR2V0RmlsZS9qYXZhZngtbGF0ZXN0L3dpbmRvd3MtaTU4Ni9qYXZhZngyLmpubHAiLz4NCiAgPC9yZXNvdXJjZXM+DQogIDxyZXNvdXJjZXM+DQogICAgPGoyc2UgdmVy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8+DQogIDwvaW5mb3JtYXRpb24+DQogIDxyZXNvdXJjZXM+DQogICAgPGpmeDpqYXZhZngtcnVudGltZSB2ZXJzaW9uPSIyLjIrIiBocmVmPSJodHRwOi8vamF2YWRsLnN1bi5jb20vd2ViYXBwcy9kb3dubG9hZC9HZXRGaWxlL2phdmFmeC1sYXRlc3Qvd2luZG93cy1pNTg2L2phdmFmeDIuam5scCIvPg0KICA8L3Jlc291cmNlcz4NCiAgPHJlc291cmNlcz4NCiAgICA8ajJzZSB2ZXJzaW9uPSIxLjYrIiBocmVmPSJodHRwOi8vamF2YS5zdW4uY29tL3Byb2R1Y3RzL2F1dG9kbC9qMnNlIi8+DQogICAgPGphciBocmVmPSJUZXN0amZ4LmphciIgc2l6ZT0iMjAyODkiIGRvd25sb2FkPSJlYWdlciIgLz4NCiAgPC9yZXNvdXJjZXM+DQo8c2VjdXJpdHk+DQogIDxhbGwtcGVybWlzc2lvbnMvPg0KPC9zZWN1cml0eT4NCiAgPGFwcGxldC1kZXNjICB3aWR0aD0iMzAwIiBoZWlnaHQ9IjEwMCIgbWFpbi1jbGFzcz0iY29tLmphdmFmeC5tYWluLk5vSmF2YUZYRmFsbGJhY2siICBuYW1lPSJUZXN0amZ4IiA+DQogICAgPHBhcmFtIG5hbWU9InJlcXVpcmVkRlhWZXJzaW9uIiB2YWx1ZT0iMi4yKyIvPg0KICA8L2FwcGxldC1kZXNjPg0KICA8amZ4OmphdmFmeC1kZXNjICB3aWR0aD0iMzAwIiBoZWlnaHQ9IjEwMCIgbWFpbi1jbGFzcz0idGVzdGpmeC5UZXN0amZ4IiAgbmFtZT0iVGVzdGpmeCIgLz4NCiAgPHVwZGF0ZSBjaGVjaz0iYWx3YXlzIi8+DQo8L2pubHA+DQo='
              },
              {
                  javafx: '2.2+'
  
              },
              {}
          );
  
          }
  
  
  
  
  
  
  function launchit(){
  dtjava.addOnloadCallback(javafxEmbed);
  }
  
  
  function callit(aa){
  alert(aa);
  console.log("____ "+aa);
  var ttt=app.tellme("maher ");
  console.log("____a "+ttt);
  
  }
  </code></pre>
  
  <ul>
  <li>Note that if you build code it may generate different jnlp_content that what I have. so just update it.</li>
  </ul>
  
  <p><strike>* I zipped all files into <a href="http://ulozto.cz/xV2vrQTd/javafx-dm-ie9-zip" rel="nofollow noreferrer">http://ulozto.cz/xV2vrQTd/javafx-dm-ie9-zip</a></strike></p>
  
  <p><strong>* Source code is here : <a href="http://247workers.com/JFX_src/TestIdleCallJavaFx.zip" rel="nofollow noreferrer">http://247workers.com/JFX_src/TestIdleCallJavaFx.zip</a></strong></p>
  
  <p><strong>Here some steps how to successfully get it work:</strong></p>
  
  <p><strong>1- I am using latest version of JDK/JRE 7u45</strong></p>
  
  <p><strong>2- using Menu File ==> import ==> import from zip</strong></p>
  
  <p><strong>3- Clean And Build</strong></p>
  
  <p><strong>4-copy all content under dist in project into directory work and overwrite any thing if you already have something there.</strong></p>
  
  <p><strong>5- it will be better to show Java Console during deploying via Control Panel ==> Java ==> Advanced ==> under Java console, choose show console.</strong></p>
  
  <ul>
  <li>About using </li>
  </ul>
  
  <p>&lt; meta http-equiv="X-UA-Compatible" content="IE=8"></p>
  
  <p>to enforce using older rendering engine but this wont be accepted on our enterprise project Im working  on.</p>
  
  <p>I hope I will get assistance here ... sorry for long post but I wanted to be very specific and provide all necessary info .</p>