August 16, 2009
IE6 hyphenated filename bug(?)
This is a bug(?) I discovered while testing a site in IE6. A cursory Google search revealed nothing similar so far, so I’ll call it the “Dash of death” bug.
Here’s the relevant XHTML, some IE6-specific Javascript:
<!--[if IE 6]> <script type="text/javascript" src="j/ie-6.js"></script> <![endif]-->
It doesn’t matter whether the conditional comments are there or not. It also doesn’t matter where the <script> tag is located in the page; I had it at the bottom of the page, but it breaks just the same within the <head> element.
The problem: You’ll notice that the filename contains a hyphen (hyphen-dash, whatever you want to call it) followed by a number. Internet Explorer 6, a browser that is deservedly on its way out, doesn’t look for j/ie-6.js on the server. Surprisingly, it asks for j/ie, for reasons unknown.
This is a line from the server’s error log:
[TIME] [error] [client 127.0.0.1] File does not exist: [PATH]/j/ie, referer: http://localhost/
This is bizarre. Another script I included, named j/ie-all.js, works fine. However, when I changed its name to j/ie-9.js out of curiosity, the bug was back.
The fix? Change the filename to j/ie6.js, keep this in mind for the next project, and find out why it works like this when there’s time.
Posted at 5:34 pm under Web development
No Comments
