Browsers syntax error in js depending on the server...only for some browsers
This is a follow up to: Debian - all browsers jquery compressed breaks all js, but uncompressed works fine
I have more information now that requires a new way of thinking about it.
A user when connecting to an apache server and is s开发者_如何学运维erved a minified version of jquery-1.6.2 results in a syntax error in the file, when it does not have one, causing the whole program to break.
When that same file is served from a nginx server, the error goes away and it works correctly.
Is there anything that can cause javascript to get served incorrectly from the server side?
EDIT: Turns out even this even causes javascript errors (http://muench.homeip.net/jquery/jquery-1.5.1-remote.html) Just including jquery 1.5.1
Only thing I can think of is if the server is corrupting the file beforehand. I wonder if gzip has anything to do with it.
Run a diff or checksum against the file from each location to ensure that they are identical. I suspect the compression is corrupting the file somehow.
Check your Response Headers for the files on both servers. You want verify that they match. Maybe, Content-Encoding is different. Perhaps, it is Gzip causing the error. Is Windows involved? If so, then OS difference in saving the file with a different charset? This sometimes happens when saving from Notepad as ANSI by accident and serving as UTF-8 (I made this mistake before).
I am assuming that you have cleared your cache. That would have been my first guess.
精彩评论