views:

163

answers:

1

When I change the "overflow" style on document.body from "hidden" to "auto", it forces a reload of a Java applet that is on the page.

I have set overflow to hidden because most of the time I don't want scrollbars to be visible on the page, but I'd like to enable them without losing state in my applet.

Is this possible, or is there another way I should be going about this problem?

A: 

It's not possible. Different browsers behave in different ways; some reload the applet with the slightest DOM change while others keep it running even if you set display: none. In my experience the Java Plugin has very little control over this.

You have to save the state of your applet either by:

  • Reading the state into a JavaScript variable via LiveConnect and then writing it back to the applet afterwards
  • Storing the state in static variables and checking their value when the Applet starts up
Spyder