Bugging IE 7 issues...

IE 7 finally gave us MDI (Multiple Document Interface), tabbed browsing capabilities that we have been waiting for since last few years. Something that Firefox implemented much earlier, but IE still lacks so many essential features that annoy most of the developers/programmers and web users!

So, here is some ranting about the recent problems that I encountered while implementing some new features for our system.

These are the browser versions I used, and they both are running on Windows XP professional -

IE 7 and cookies -

I love the way Firefox allows me to view & manage cookies with great GUI (see image below) -

Cookie Management with FireFox

It’s pain going through hundreds of files stored under some obscure profile & location on hard disk (typically ‘C:\Documents and Settings\{user_name}\Cookies’) and then find the appropriate cookie file & view its contents. As a hardcore programmer, I can dig, hack if (and only *iff*) needed - but otherwise I am lazy!! And when Firefox can show me cookies along with all their related information so cleanly, why bother exploring C: and those obscure directories?

IE on the other hand doesn’t give any interface to examine cookie contents and ability to selectively delete the cookies via interface.

As for implementation shortcomings - for some weird reasons, IE 7 still allows only 20 cookies to be stored per domain. And consider that at least 3-4 out of them will be used implictly by your application server itself for session management. Here is what RFC 2109 section 6.3 says about minimum requirements of a browser supporting cookies -

User agents created for specific purposes or for limited-capacity devices should provide at least 20 cookies of 4096 bytes, to ensure that the user can interact with a session-based origin server.

Well, I wasn’t testing it all on ‘limited-capacity devices’ - I was testing it on Windows XP professional with 80 GB HDD and some 4 GB memory. Still IE couldn’t store more than 20 cookies for a domain.

So, in case of IE it seems that the maximum number of cookies that can be stored per domain is equal to the minimum number of cookies that it must support. So maximum of only 20 cookies in IE per domain!! And I had form with over 40 search fields and many other forms/services did set their own cookies as well. And obviously there was ‘jsessionid’! I had pretty tough time figuring out why only few fields were populated with their older values while few remained blank or with their default values. That was quite annoying & puzzling before I decided to write a small application to just set & read cookies that revealed that IE 7 can keep only 20 cookies per domain.

Obviously I found a workaroud to club & stuff multiple cookies into a single cookie; but that did add some additional parsing overhead as well. On the other hand Firefox did take some 34 cookies from a single domain from various services/forms without a problem. Of course, the code is refactored to use much lesser cookies now but still each form or service can have its own single cookie & things get complicated when you have over 100 such forms in various parts of your application/system. Not everything can, and should get in the DB.

I could not find any official documents quoting the actual figures for browsers’ cookies limits, but this site tests (by actually allowing you to set & read cookies) and mentions that Firefox can remember/keep upto 50 cookies & IE can remember upto 20 cookies per domain (as I had discovered). Interestingly, Safari keeps some 1000 odd cookies as mentioned by the site!!!!

Moral 1 = Don’t go overboard on cookies, stay below minimum limit of 20; otherwise IE will eat them up!! ;-)

Extending DOM element and IE 7 -

This was yet another shock on the same day while I was trying to develop same set of features for the system. I decided to use some Object Oriented JavaScript to implement some of the features that I needed to add. I thought extendending functionality of HTML select element would let me accomplish most of the things that I wanted to add. I thought most modern browsers must be allowing DOM element prototypes to be extended. So I wrote few functions for the HTML select element to extend its functionality for me to manage the select lists conveniently.

This was one of the functions that I wrote to extend HTML Select Element -

HTMLSelectElement.prototype.selectOptionForValue = function(optionValue){
 for(var i = 0; i < this.length; i++){
       if(this.options[i].value == optionValue){
              this.selectedIndex = i;

This worked perfectly fine in Firefox where I tested it first. But to my horror I found that it didn’t work in IE 7. Sure I was working on client side JavaScript after a long time; but it was still difficult for me to digest that such a basic functionality is still not supported by IE 7. I kept gazing at the screen that read error message (see image below) -

Error: 'HTMLSelectElement' is undefined

Internet Explorer - Error: ‘HTMLSelectElement’ is undefined

Luckily, finding workaround this time was much simpler and I wrote a simple function call to do the same. Nevertheless, it did come as a rude shock to me to see that IE 7 didn’t allow DOM element prototypes to be extended to add desired functionality.

Moral 2 = IE doesn’t like DOM element prototypes to be extended, so stick to regular function calls for cross-browser compatibility. After all, IE DOMinates the browser market! ;-)

Gist of 1 + 2 = Jokes & flames apart! Seriously, if browsers start selling purely based on their features, reliability, standard compliance (CSS, JS etc.) and security (don’t even get me started on IE vulnerabilities); I doubt if Internet Explorer would share even half of its present market share in the browser market that it enjoys today due to omnipresent M$ Windows!!!

I hope Microsoft is lurking & noting these issues and we would see these things getting implemented in the next version of IE!! Meanwhile I do have very good reasons to dislike IE and stick to my FireFox! :-)

You can download FireFox here - probably the best browser one can get today. With its MDI interface (tabbed browsing), pop-up blocking and all such features, it's just an "absolutely must" for any serious web surfer. I haven't been using IE much eversince I have discovered FireFox. And plug-ins such as firebug make it even much more useful for a web developer.
Author : Manish Hatwalne.