I suffered a lot by chrome when embedding the applet into page during these days.
Fortunately, I figure out what the tricky parts of it:)
1) Firstly, we need get rid of all security issues which should be addressed by jarsigner with the following MANIFEST.MF
If you know nothing about jarsigner, the chrome frozen issue is out of your ability to resolve it:)
2) After that, the code work perfectly on firefox but randomly freeze the chrome browser which depress me a lot.
Is it a chrome issue? yes and no.
Chrome just didn't handle the exceptions correctly when we call applet method before applet's get actually started. We need to call applet method after applet's start life cycle.
Here is applet's life cycle:
Fortunately, I figure out what the tricky parts of it:)
1) Firstly, we need get rid of all security issues which should be addressed by jarsigner with the following MANIFEST.MF
Here is the reference for all applet jar manifest: http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/manifest.html
Manifest-Version: 1.0
Application-Library-Allowable-Codebase: *Caller-Allowable-Codebase: *Codebase: *Permissions: all-permissions
Archiver-Version: Plexus ArchiverApplication-Name: XXXXXBuild-Jdk: 1.7.0_45Built-By: lzhengCreated-By: Apache Maven 3.0.4
If you know nothing about jarsigner, the chrome frozen issue is out of your ability to resolve it:)
2) After that, the code work perfectly on firefox but randomly freeze the chrome browser which depress me a lot.
Is it a chrome issue? yes and no.
Chrome just didn't handle the exceptions correctly when we call applet method before applet's get actually started. We need to call applet method after applet's start life cycle.
Here is applet's life cycle:
public class Simple extends Applet { StringBuffer buffer; public void init() { System.out.println("initializing... "); } public void start() { System.out.println("starting... "); } public void stop() { System.out.println("stopping... "); } public void destroy() { System.out.println("preparing for unloading..."); }
}
We need to override the start() function to tell page, the applet start successfully.
@Override public void start() { win.eval("onAppletStartHandler();"); //onAppletStartHandler is the callback function defined in JS. }we put related applet code which are used to get information automatically using applet when page get loaded to "onAppletStartHandler()".
Easy fix, then chrome stuck issue should go away:)
i did this, and i still get applet hanging on chrome.
ReplyDeleteI summarized all possible applet stuck issues there, hope it helps.
ReplyDeletehttp://springflex.blogspot.com/2014/09/my-practices-to-resolve-applet-stuck.html