Workaround for Delay when using LiveConnect
This page suggests a workaround for a problem described here. This technique should work with any Java Applet, including ListenUp.
To Do
- Bookmark this page so you can come back.
- Exit the browser. Bye! (If you don't do this then you are not really testing the fix.)
- 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.
- Note that the elapsed time is very short. Yay!
How to Use this Workaround in Your Code
Step 1: Define this JavaScript function in your page <head> tag.
IMPORTANT: Change "document.NameOfYourApplet" to use the actual name of your Applet. This is set using the name parameter in in the <applet> tag.
// Keep checking to see if Applet is loaded. // This call to isActive() will be the first // LiveConnect call and will hide the delay from the user. function touchLoadLiveConnect() { if( !document.NameOfYourApplet.isActive() ) { // Wait 100 milliseconds and try again. setTimeout('touchLoadLiveConnect()', 100 ); } }
Step 2: Call this function after the Applet <tag>
// Force LiveConnect to load in background so we do not notice delay. setTimeout( 'touchLoadLiveConnect()', 10 );