Reputation: 13
Is it possible to use one applet on a HTML page and if I open an other HTML page that call's the same applet to use the instance the applet we created before and not new one?
I am creating actually 5 HTML pages and I want my applet not to destroy and create new instances every time. I want to use the last instance every time. Almost every applet needs init()
method, when it is first loaded on the HTML. And that creates a new instance for every page.
Is there something that I can do about it?
Upvotes: 1
Views: 275
Reputation: 20919
I'm pretty sure this isn't possible. The only way you can ensure that the same instance of the applet persists is to keep the same page loaded in the browser. However, nowadays it's pretty standard to keep the same page loaded, but alter its content in all kinds of ways by manipulating the DOM via JavaScript.
The product I work on is a website containing an applet that must remain loaded throughout the user's session, and this is basically how it works. If you have points during the interaction where the applet shouldn't be visible, you can use JavaScript to change its coordinates within the page so it's outside the visible bounds of the window, effectively making it disappear.
Upvotes: 1