The WebRenderer WRUIprotocol
allows for communication from JavaScript
to Java. Using the WRUI protocol you
can directly communicate with Java and with some
simple handler code you can drive methods,
assign variables etc.
Example: (HTML
file with JavaScript calling through to
Java when an HTML Button is clicked)
<HTML> <SCRIPT
JAVASCRIPT> function runJavaCode(){ document.location
= "wrui://runConsoleOutput"; } </SCRIPT>
<HEAD><TITLE>WebRenderer
- WRUI Test Page</TITLE></HEAD> <BODY> <BR> Press
this button <INPUT type=button value='Click
to execute' onclick='runJavaCode()'>
execute JavaScript that will call a Java
function </BODY> </HTML>
//
Java browser.addBrowserListener(new
BrowserAdapter(){ public
void onBeforeNavigate(BrowserEvent e){ //Catching
the WRUI communication if(e.getURL().equals("wrui://runConsoleOutput/")){ //Calling
a Java method using WRUI as a communication
bridge runConsoleOutput(); } } });