Re[3]: Opera and the Back button
2005/05/13 11:07
Viewed 18300 times
Replies: 1/1

And this was their response...

  • If you go back Opera uses a cached version in which the script wasn't ended correctly. Therefore the script can't get active again it's ended by reloading the page.

I'm not sure I really understand what they mean and I'm hoping it might make more sense to you so that you might be able to suggest a work around or give me some more ammunition to fire back at Opera support.

Hmm, that doesn't make any sense to me either.  The menu script doesn't “end”.  It installs some hooks (some event handlers) that get called when you mouseover or click the menu items, or even press keyboard combinations (but that doesn't work in Opera either because Opera has a million shortcuts, which can't be overwritten from JS).

After deciphering the error messages, I am sure that the problem appears because Opera only saves “known” attributes of DOM nodes, such as class, id, etc.  But DynarchMenu uses some custom attributes in order to link DOM nodes to JavaScript objects, and those attributes become “undefined” when you click “back”, which renders the menu unusable.

While you're at it, you might also want to tell them that there's yet another “optimization” which is not nice: Opera doesn't load images unless they are visible.  But for instance, there's a common technique to preload images in an invisible DIV--Opera will request those only when they become visible, which is why icons get loaded after submenus popped up.

I know they say it's the fastest browser on Earth, but they should make some “compromises” too...

Re[4]: Opera and the Back button
2005/05/26 04:16
Viewed 20692 times
Replies: 0/0

We have done a bit more testing here and have come up with a method to capture the error and fix the menu. It's a bit nasty but it seems to work however I don't have the knowledge of your code to fully implement a "correct" solution.

The basic premise is to add try.. catch blocks to the DynarchMenu.EventHandlers for each event and catch the exception that Opera generates. Then inside the exception handler we added a call to DynarchMenu.setup.

This had a few problems, those being that the original UL for the menu is deleted and that it created a second instance of the menu. We fixed these by removing the code that deletes the UL and by adding an ID to the created menu so that we could delete it in the setup function.

This seems to work fairly well for the instance where these is only a single menu but has a hard coded call to the DynarchMenu.setup inside the exception handler that includes the menu name and options so obviosuly this breaks when there is more than one menu (we have context menus on graphs and tables so this is a problem).

So, I guess my question comes down to this...
a) Is there a way we could store each of the created menus in the menu object and then be easily able to remove then recreate all the menus in the exception handler?
b) would you be willing to add this?

Regards,
Michael

last
Google