Firefox "intelligently" and silently fixes incorrect file references in CSS and Scripts at runtime. Driving me nuts!
Well this is a really weird issue, I really didn't find anything on this elsewhere so I thought I'd address it here.
Say I have an "image.jpg" and accidentally reference it in the CSS like so:
url(imag.jpg)
Note the missing "e". Now for me, Firefox is so incr开发者_运维技巧edibly clever that it will still find the correct image, but not spit out a warning. So I assume that everything is ok.
But later, when I test the page in any other browser, all of a sudden the image doesn't display (and rightly so). That's because Firefox thought it was a good idea to correct my error without telling me.
This becomes more critical with scripts. Firefox will also auto-correct a typo in a <script src="">
reference.
I just wasted a whole hour scratching my head and trying to debug an ajax function in Webkit - turns out, I just had a typo where I included the file.
Why on earth does Firefox do this without telling, and where the heck can I turn this off? This has first occured somewhere around FF 3.0 and still persists in 3.6.3.
/rant an thank fo any inpu ;)
EDIT: Thanks for your answers so far. I've uploaded a demo
EDIT 2: Thanks to the great input below, I found out that it was my server having the CheckSpelling module on (Apache). Solution: Add
CheckSpelling OFF
to the .htaccess and that fixes it. Thanks again to all.
PS. I'm sorry that I blamed you, Firefox. You're still the best!
I don't think this has anything to do with Firefox. Your script also gets included in IE, which leads me to believe your web server is redirecting the request to the real file, not Firefox. What web server are you using? IIS?
When I browse to http://soapdesigned.com/firefox-test/scrip.js
in IE, I get prompted to download script.js, the correct file.
Update: After examining with Fiddler, when I request scrip.js, I get HTTP 301 (Moved Permanently).
I think what you're seeing is mod_speling (or something like it) in action:
http://httpd.apache.org/docs/2.0/mod/mod_speling.html
It's an apache module meant for correcting minor mis-spellings.
Requests to documents sometimes cannot be served by the core apache server because the request was misspelled or miscapitalized. This module addresses this problem by trying to find a matching document, even after all other modules gave up. It does its work by comparing each document name in the requested directory against the requested document name without regard to case, and allowing up to one misspelling (character insertion / omission / transposition or wrong character). A list is built with all document names which were matched using this strategy.
This is not Firefox, it is something in your server:
~% curl -v -o/dev/null http://soapdesigned.com/firefox-test/scrip.js * About to connect() to soapdesigned.com port 80 (#0) * Trying 82.165.116.124... connected * Connected to soapdesigned.com (82.165.116.124) port 80 (#0) > GET /firefox-test/scrip.js HTTP/1.1 > User-Agent: curl/7.19.5 (x86_64-pc-linux-gnu) libcurl/7.19.5 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.15 > Host: soapdesigned.com > Accept: */* > < HTTP/1.1 301 Moved Permanently < Date: Sat, 17 Apr 2010 22:44:08 GMT < Server: Apache < Location: http://soapdesigned.com/firefox-test/script.js < Transfer-Encoding: chunked < Content-Type: text/html; charset=iso-8859-1 < * Connection #0 to host soapdesigned.com left intact * Closing connection #0
Your server probably is running mod_spelling, which detects failed requests to nonexistent files and tries to redirect to other files with similar spellings.
精彩评论