WHITE PAPERS  |  PRICING  |  DOWNLOADS

 

username

password

 

 

 

 

 

 

 

 

 

 

  Swing Edition Details  

 

  > Features  

  > Key Benefits  

  > Screenshots  

  > Standards Supported  

  > Pricing  

  > Download Now

 

 

  Developer Resources  

 

  > API Documentation  

  > Developers Guide  

  > Code Examples  

  > Updated Builds  

  > Technical Articles  

 

 

 

 

 

Jump to:

General WebRenderer Functions

  WebRenderer example code base.

 

Advanced WebRenderer functions

 

Application test examples

 

Deploying WebRenderer

WebRenderer DOM

  

  

 

Java to JavaScript communication with WebRenderer

 

 

Click here to download working example code

 

Deploying WebRenderer in a Java Applet

WebRenderer has two effective methods used for communicating between Java and JavaScript code. The methods available consist of the executeScript method and the executeScriptWithReturn method found in IBrowserCanvas.

executeScript: - executeScript takes a String containg any valid JavaScript which will be immediately executed on the page loaded in WebRenderer. Using this method you can directly call global or custom JavaScript functions.

Example:
//Changing the current documents background color to green
browser.executeScript("document.body.style.backgroundColor='green';");
//Throwing a JavaScript Alert dialog box
browser.executeScript("alert('Background color changed');");

executeScriptWithReturn:
- executeScriptWithReturn returns any variable from JavaScript or method return values that you choose to call it upon.

Example:
//Executing some JavaScript - Calling a function in JavaScript that
//has a return value and passing the return value back to Java.
System.out.println(browser.executeScriptWithReturn("document.title"));

The executeScriptWithReturn can be called on any JavaScript function or variable and it will return the value.

For information on communicating from
JavaScript to Java please see click here.. 

  top

 

 

 Sun, Sun Microsystems, and the Sun Logo are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries 

Privacy Policy  |   Disclaimer