Workaround for Delay when using LiveConnect
JavaScript can call Java using a technology called LiveConnect. We have noticed that there can be a 3 to 4 second delay the first time that JavaScript calls Java after the browser is launched. It only happens on the first call.
To Do
- Bookmark this page so you can come back.
- Exit the browser. Bye! (If you don't do this then you probably won't see the delay.)
- Relaunch the Browser and return to this page. Hello again!
- Click here -> Call Java Applet
- Look for a printed message in the Java Applet below. It will take a while to show up.
- Note that the elapsed time is several thousand milliseconds.
- Click that link above again and notice that the delay is very short.
- Visit the next page, which offers a workaround for this problem.
The function that calls the Java Applet is:
// Send the current time in milliseconds to the Java Applet. // The Applet then checks the time it receives the call and prints the difference. function sendTimeToApplet( message ) { myDate = new Date(); document.TestLiveConnectApplet.showElapsedTime( message, myDate.getTime() ); }