简体   繁体   中英

java applet freezes browser and way to communicate between javascript and applet

I have applets in my projects. When I want to display applet I load that applet using the applet tag in jsp page and load that page in div tag. it work fine. but when more applets loaded in same browser window then this window is slow down and sometime freezes and applets also becomes unresponsive . when i close the applet the loading div tag still in webpage.

is there any way to communicate betwwen applet and javascript. so that when applet close we are able to remove particular div or set to empty in which applet loaded.

When more applets loaded I check with top command java uses more memory and cpu also.

is there any way to minimise it or communicate between applet and javascript.

Thanks

To communicate with applets, all you need to do is mark methods as as public and call them like so:

<applet code="com.something.MyApplet"
mayscript="true" name="myApplet" width="200" height="100">

Assuming a doSomething method, call it like so from your web page:

myApplet.doSomething("Hello");

As far as the web-page crashing, that's harder to debug, try different embedding methods in different browsers. Try to avoid serving more than one or two applets. Try to figure out if an applet in particular is causing a proble.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM