CodeSOD: The Firefox Fix

This post was originally published on this site

The Daily WTF

Yitzchak was going through some old web code, and found some still in-use JavaScript to handle compatibility issues with older Firefox versions.

if ($.browser.mozilla && $.browser.version.slice(0, 1) == ‘1’) { … }

What a marvel. Using JQuery, they check which browser is reported- I suspect JQuery is grabbing this from the user-agent string- and then its version. And if the version has a 1 in its first digit, we apply a “fix” for “compatibility”.

I guess it’s a good thing there will never be more than 9 versions of Firefox. I mean, what version are they on now? Surely the version number doesn’t start with a “1”, nor has it started with a “1” for some time, right?

To read the full article click on the 'post' link at the top.