views:

87

answers:

1

I have two applets A and B. They are embedded in separate pages. On destroy, A serializes objects to the local file system. On init, B deserializes these objects. This set-up works fine in Windows. Unfortunately, I have discovered that it doesn't work in Mac OS X. This is because B is initialized before A is destroyed. Does anyone know if there is some applet param or setting or configuration or work-around that will allow the Mac OS X Java plug-in to behave similar to the Windows one?

Browser: FF 3.0 OS: Mac OS X 10.4 Java plug-in version: 1.5.0_06

+1  A: 

You are just lucky that this has been working under Windows, and even on Windows, the behaviour is probably browser specific. According to the API documentation, the applet's stop method will be invoked 'when the Web page that contains this applet has been replaced by another page' and the destroy method will be invoked after the stop method. Note the 'when ... has been' and not 'before ... will be'. Short summary, if you replace an HTML page with applet A with an HTML page with applet B, the applet API provide no way to make sure that some method of applet A is invoked and completed before applet B is intiialized or started.

If you enable scripting of your applet, you have however implement a kind of save method in applet A and invoke this method using Javascript from page A, before even trying to load page B.

jarnbjo