Over a million developers have joined DZone.

Say Hello to JavaScript-Java bridge in JxBrowser 3.0

DZone's Guide to

Say Hello to JavaScript-Java bridge in JxBrowser 3.0

· ·
Free Resource
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.

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/

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}