Skip to main content
added 6 characters in body
Source Link
machineghost
  • 36k
  • 33
  • 174
  • 269

Here's a REALLY fun one (/sarcasm off) that I discovered. If you have a MIME type of "application/javascript", rather than "text/javascript" Internet Explorer will: A

A) ignore the unexpected MIME type and use the file anyway? B

B) not load the file at all? C

C) take the first hundred or so lines of the file, prepend them to another JS file that comes before it in the HTML, and then give you all sorts of errors because your out of order-of-order half file + actual file doesn't work?

That's right, the answer is C ... I kid you not. We used to use the "application/javascript" MIME type to prevent JS file caching in IE6/7, and as a result I just wasted an entire day trying to figure out why IE8 was giving some really crazy errors. Luckily I finally figured out what was going on when it told me I had an error on line 650 of a 500 line file (and then when I viewed the file in the debugger I saw the prepended other file).

Moral of the story: if you want IE8 to work DO NOT use "application/javascript" for your JS files' MIME type.

Here's a REALLY fun one (/sarcasm off) that I discovered. If you have a MIME type of "application/javascript", rather than "text/javascript" Internet Explorer will: A) ignore the unexpected MIME type and use the file anyway? B) not load the file at all? C) take the first hundred or so lines of the file, prepend them to another JS file that comes before it in the HTML, and then give you all sorts of errors because your out of order half file + actual file doesn't work?

That's right, the answer is C ... I kid you not. We used to use the "application/javascript" MIME type to prevent JS file caching in IE6/7, and as a result I just wasted an entire day trying to figure out why IE8 was giving some really crazy errors. Luckily I finally figured out what was going on when it told me I had an error on line 650 of a 500 line file (and then when I viewed the file in the debugger I saw the prepended other file).

Moral of the story: if you want IE8 to work DO NOT use "application/javascript" for your JS files' MIME type.

Here's a REALLY fun one (/sarcasm off) that I discovered. If you have a MIME type of "application/javascript", rather than "text/javascript" Internet Explorer will:

A) ignore the unexpected MIME type and use the file anyway?

B) not load the file at all?

C) take the first hundred or so lines of the file, prepend them to another JS file that comes before it in the HTML, and then give you all sorts of errors because your out-of-order half file + actual file doesn't work?

That's right, the answer is C ... I kid you not. We used to use the "application/javascript" MIME type to prevent JS file caching in IE6/7, and as a result I wasted an entire day trying to figure out why IE8 was giving some really crazy errors. Luckily I finally figured out what was going on when it told me I had an error on line 650 of a 500 line file (and then when I viewed the file in the debugger I saw the prepended other file).

Moral of the story: if you want IE8 to work DO NOT use "application/javascript" for your JS files' MIME type.

Source Link
machineghost
  • 36k
  • 33
  • 174
  • 269

Here's a REALLY fun one (/sarcasm off) that I discovered. If you have a MIME type of "application/javascript", rather than "text/javascript" Internet Explorer will: A) ignore the unexpected MIME type and use the file anyway? B) not load the file at all? C) take the first hundred or so lines of the file, prepend them to another JS file that comes before it in the HTML, and then give you all sorts of errors because your out of order half file + actual file doesn't work?

That's right, the answer is C ... I kid you not. We used to use the "application/javascript" MIME type to prevent JS file caching in IE6/7, and as a result I just wasted an entire day trying to figure out why IE8 was giving some really crazy errors. Luckily I finally figured out what was going on when it told me I had an error on line 650 of a 500 line file (and then when I viewed the file in the debugger I saw the prepended other file).

Moral of the story: if you want IE8 to work DO NOT use "application/javascript" for your JS files' MIME type.