It is really annoying to develop for Firefox *and* Internet Explorer. Both do different CSS and Javascript. For me a two monitor setup saves time and clicks. As the blog’s sidebar went bigger and bigger I was looking for a solution capable of saving the current state with expanded and collapsed tree items, so when you enter the site again the sidebar will have same look and size.

I did not choosed database for saving. As a good alternative cookies can save it locally at users side of internet. All <li> in sidebar got an unique id attribute and all collapsed nodes make a string like ‘.nt01.nt02.’ All left was saving on onunload event and applying at onload event. Here the story starts:

IE starts displaying page before load event fires. Which let you see the sidebar twice in a row first in expanded view and later in custom view. Firefox behaves proper and without flicker.

Next idea was to generate the needed style info with with server side scripting. A PHP function first reads the cookie and then chooses ‘block’ or ‘none’ as display style to appropiate nodes. Now it works proper in IE but not any longer with Firefox.

The behaviour now leads to confusing results, I managed Firefox to do exactly the opposite of what was expected. Actually I saw the state of sidebar safed 2 steps before. Alerts placed in both onload and onunload helped to get some light while pressing F5 and reload. Firefox first starts loading new page (which is the same in this case) and then leaves the old page. So onload is fired before onunload and the cookie is not saved, well, it is saved but too late.

All needed is load behaviour of FireFox and exit strategy of IE. Mission impossible. Not now. As a semi perfect solution cookies are saved everytime you configure sidebar and thats the reason why HDD LED blinks while clicking. With Firefox 1.5 I’ll test it again to achieve a less harddisk stressing method. Two cookie entries are used to save sidebar layout of blog view and map view.

Update 1: In map view accesskeys are useful. Firefox and ALT-P toggles placenames, IE still needs a second step with pressing enter and hidden buttons are not reachable. There exists a Javascript work around that, an implementation is planned.

Update 2:: Now some codelines later a lot of new quirks have popped up. Sometimes IE fails in loading WMS maps and it seems it makes a different if you write code in one line or split into more lines.

Look this example:


for (var i = 0; i < geoLink.numMaps ; i++)
{
this.addMap(EOP.maps[i]);
}

Once I tried to shrink these lines into a single one, but then IE does not loads maps any longer. May be there are side effects elsewhere and with IE 7 everything runs better. Till then I encourage you to use Firefox for a better internet experience.