HTML & JavaScript Compatibility Hell for Programmers

By Akbar

If you are HTML Designer or JavaScript programmer, then you may already know the rule that it almost 50% of the development time to make what works in browser,  and another 50% of the time is spent to run it smoothly in all the other popular browsers (some time it takes even more).

Recently, I was working on script where from the on-click event handler I have to find and return the containing iFrame reference. Searching on the Google, I found that you can do this by using something like:

var winReference = activeElement.ownerDocument.parentWindow.frameElement;

But guess what, it was only working in the IE. So now I have to start again the search for the alternatives which works in the all other browsers as well. Doing this, I found one of my long waited reference link:

The above link contains the comparability tables for the HTML, CSS and DOM. Lot more than what I was expecting. A big thanks to Peter-Paul Koch for maintaining these tables and sharing with the community. It’s now my #1 resource for the compatibility reference.

BTW, for some of you who don’t want to go the compatibility link, the answer to find the parent window reference in the FireFox and other browses is:

var winReference = activeElement.ownerDocument.defaultView.frameElement;

Next time, don’t hit the wall when you stumbled upon some JavaScript issues, check the compatibility tables first.

Tags: ,