Wednesday, May 28, 2008

Dynamically generated JavaScript files should have proper content-type header

Problem:
IE6 throws runtime errors on an error-free JavaScript file generated on the backend using JSP, PHP, ...etc.

Solution:
These runtime errors are due to IE6's inability to parse the file properly. Define the content-type of the document and set it to text/javascript. This will properly format the document and will remove any runtime errors thrown in IE6.

No comments:

Blog Archive