[lug] browser button events to Java

rm at mamma.varadinet.de rm at mamma.varadinet.de
Sat Oct 28 11:23:03 MDT 2000

On Fri, Oct 27, 2000 at 05:44:42PM -0600, Ferdinand P. Schmid wrote:
> One thing you could investigate - if your hosting environment supports
> servlets is storing a state serverside.  Then your applet could receive that
> information from the server.  A long detour - but possible.

Hmm, don't see how you could get an event to the server ...

> JavaScript is generally fairly broken - every browser interprets it
> differently.  Same is true for applets if you use the browser's own JRE.  So
> I would test your code at least in Netscape and IE.
> Ferdinand
> Michael Wegener wrote:
> > Hello everyone,
> >
> > We're trying to build an applet that gets events from the browser's
> > back/forward buttons, and are having some difficulty. There is a way to
> > interface JavaScript to Java, but requires that the active frame contain
> > the JavaScript, and since our applet occupies another frame, we seem
> > stuck. Has anybody done this or run across a viable method before?

I'm not following the 'Java in the browser' development lately but
as far as i know there is no way to fiddle with the browsers event
loop from within the JVM (this would be a pretty big security problem
anyway). It might be possible to use JavaScript/Java solutions on
some browsers but i see several problems:

 - If your applet is on a page that the user is a bout to leave 
   the applet might (!) get unloaded and garbage collected. Calling
   a method of a garbage collected object might give you anything from
   a warning to a browser crash.

 - The 'semantic' of the back button is different for different browsers.
   Sometimes you leave a frame, sometimes you leave the entire frameset.

If've done some java  stuff that relies on JavaScript/Java functionallity,
but this was allways the most problematic spot in the application.
Also, many users switch of JavaScript/Java interaction (and with _very_
good reason, this 'feature' has a long history of security problems).


More information about the LUG mailing list