title: JxBrowser 6.1 JavaScript Java Bridge API is not working
body: <p>I think that there is a problem with the JavaScript Java Bridge API in JxBrowser 6.1 . I have tried a very simple code to call a method of a java class in Javascript. Here are the codes. In java, <code>java</code> is set as a property on javascript <code>window</code> object to an instance of <code>Events</code> class and then the html is loaded. In html, I simply call <code>Close</code> method of <code>Events</code> class. But when I click the <code>Close</code> button, java <code>Close</code> function doesn't get called and there is a message in console from JxBrowser saying : </p>
  
  <p><strong>Uncaught TypeError: Cannot read property 'Close' of undefined</strong></p>
  
  <p>which means that <code>java</code> property for <code>window</code> object is not defined.</p>
  
  <p><strong>Main.java:</strong></p>
  
  <pre><code>public class Main extends Application {
  
      private Browser browser;
  
      public static void main(String[] args) {
  
          launch(args);
  
      }
  
      @Override
      public void start(Stage primaryStage) {
  
          Platform.setImplicitExit(false);
  
          browser = new Browser();
  
          JSValue window = browser.executeJavaScriptAndReturnValue("window");
  
          window.asObject().setProperty("java", new Events());
  
          BrowserView browserView = new BrowserView(browser);
  
          StackPane pane = new StackPane();
  
          pane.getChildren().add(browserView);
  
          Scene scene = new Scene(pane, 330, 470);
  
          primaryStage.initStyle(StageStyle.UNDECORATED);
  
          primaryStage.setScene(scene);
  
          primaryStage.show();
  
          browser.loadURL(Main.class.getResource("templates/simple.html").toExternalForm());
  
      }
  
  }
  
  class Events {
  
      public void Close() {
  
          System.out.println("close button clicked");
  
      }
  
  }
  </code></pre>
  
  <p><strong>simple.html:</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"/&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;button id="Close"&gt;Close&lt;/button&gt;
      &lt;script&gt;
          document.getElementById('Close').onclick = function () {
              window.java.Close();
          }
      &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is the article i've used to do this: 
  <a href="https://jxbrowser.support.teamdev.com/support/solutions/articles/9000013062-calling-java-from-javascript" rel="nofollow">https://jxbrowser.support.teamdev.com/support/solutions/articles/9000013062-calling-java-from-javascript</a></p>
  
  <p>Please correct me if i'm wrong.
  Thanks in advance.</p>