Teamdev has posted 7 posts at DZone. View Full User Profile

Say Hello to JavaScript-Java bridge in JxBrowser 3.0

03.19.2012
| 2557 views |
  • submit to reddit
Location: 
Java
Good news for anyone who needs an ability to call Java functions from JavaScript code on a web page. With JxBrowser 3.0 you can now do it easily.

JxBrowser is a Java library that allows embedding Mozilla, Internet Explorer and Safari web browser component into a Swing-based Java desktop application on different platforms.

In JxBrowser 3.0 a new delicious feature was introduced -  JavaScript-Java bridge. JavaScript-Java bridge is the way to invoke any Java code from JavaScript on the loaded web page. This feature is available for all JxBrowser engines (Mozilla, Internet Explorer & Safari) on all supported platforms. All you need is register a BrowserFunction instance on Java side:

browser.registerFunction("MyFunction", new BrowserFunction() {
   public Object invoke(Object... args) {
       for (Object arg : args) {
           System.out.println("arg = " + arg);
       }
       return "MyFunction Result";
   }
});


… and now you can call this Java function from JavaScript in a very simple way:

MyFunction('Arg1', 'Arg2', 100, 200.1);

Connecting JavaScript and Java is now a piece of cake with JxBrowser JavaScript-Java bridge.

JxBrowser 3.0 has a lot of other improvements and features. On Mozilla engine side, support for web pages with Java Applets on Windows was introduced. Mozilla Print functionality provides an easy way to print a web page on a default system printer. On Internet Explorer side W3C support for IE DOM API was implemented.
See the full “menu” for JxBrowser 3.0 release in the release notes.
http://links.teamdev.com/jxbrowser-release-notes.

Use the power of Mozilla, Internet Explorer and Safari in your Java application!

The new version of JxBrowser is available for download and evaluation from the company’s website at http://www.teamdev.com/jxbrowser/. On questions related to JxBrowser, please contact the product support team at jxbrowser-evaluation@teamdev.com or visit the support forum http://support.teamdev.com/jxbrowser.

About TeamDev
TeamDev Ltd. is a Java software development company headquartered in Kharkiv, Ukraine. Since 1994, we have been providing cutting-edge development services to our customers worldwide. http://www.teamdev.com/
0
Published at DZone with permission of its author, Teamdev Ltd.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)