views:

166

answers:

3

Hello All,

I am currently working on a website. For debugging reasons, i chose the view source option of firefox v3.6b4. Then i clicked on javascript link eg something like this from within the source page:

<script type="text/javascript" src="./dealer/dialog/jquery-1.3.2.min.js"></script>

Guess what, it showed me below message:

<HTML>
<HEAD>
<TITLE>404 Not Found</TITLE>
</HEAD>
<BODY>
<H1>Not Found</H1>
The requested document was not found on this server.
<P>
<HR>
<ADDRESS>
Web Server at souq4cars.com
</ADDRESS>
</BODY>
</HTML>

<!--
   - Unfortunately, Microsoft has added a clever new
   - "feature" to Internet Explorer. If the text of
   - an error's message is "too small", specifically
   - less than 512 bytes, Internet Explorer returns
   - its own error message. You can turn that off,
   - but it's pretty tricky to find switch called
   - "smart error messages". That means, of course,
   - that short error messages are censored by default.
   - IIS always returns error messages that are long
   - enough to make Internet Explorer happy. The
   - workaround is pretty simple: pad the error
   - message with a big comment like this to push it
   - over the five hundred and twelve bytes minimum.
   - Of course, that's exactly what you're reading
   - right now.
   -->

What is happening there? I am unable to open the JS file !

Firefox showing a message about microsoft and IE !!!

+3  A: 

Most likely is that the server is rejecting requests to the URL without the expected HTTP REFERRER header. This will prevent people from grabbing files directly, rather than being referenced by the expected file.

Try to spoof the referring header and attempt to see if you get the same response.

It's either that or the JavaScript path does not actually exist, thus throwing a 404 error.

monksy
+1  A: 

Er, no. FireFox is showing a message created by the author of the custom error page at souq4cars.com.

Jeremy McGee
+11  A: 

The path to your JavaScript file is most likely incorrect.

Thus, you are (rightly) getting your provider's standard 404 error file.

That error file contains a comment in order to make it larger than 512 bytes.

That is, as the comment points out, because Internet Explorer does not display custom 404 error pages if they are smaller than 512 bytes (source). If they are smaller, it will display its built-in "the page you were looking for could not be found" message.

Correct the path to your JavaScript file and you should be fine.

Sadly, there is no automated mechanism that warns about Javascript files that were referenced to but could not be loaded (I still don't understand why - a browser that can throw Javascript errors could also complain about a missing file). Firebug's net tab is a great way of finding out whether a JavaScript file has been loaded or not, I can recommend that very much for development.

Pekka