Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery Uncaught SyntaxError
    primarykey
    data
    text
    <p>I've got a JSP which is outputting the following HTML:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="jquery-1.4.3.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>When I open this page in Chrome, I get:</p> <pre><code>Uncaught SyntaxError: Unexpected token : jquery-1.4.3.min.js 120 jquery-1.4.3.min.js:-1Resource interpreted as script but transferred with MIME type application/octet-stream. jquery-1.4.3.min.js -1 </code></pre> <p>When I open is in IE 8, I get:</p> <pre><code>Message: Expected '}' Line: 109 Char: 466 Code: 0 URI: http://localhost:8080/jquery-1.4.3.min.js </code></pre> <p>I've had similar errors with JQuery 1.4.2 and with the unminified versions of the jQuery JavaScript.</p> <p>Please could someone show me what I'm doing wrong?</p> <p>Thanks.</p> <hr> <p><strong>UPDATE</strong></p> <p>I've fixed my mime-types, but I still get an error. Now it is simply a </p> <pre><code>Uncaught SyntaxError: Unexpected token : </code></pre> <p>Here are the response headers from the jQuery request on my server:</p> <pre><code>Cache-Control:max-age=32400, s-maxage=0 Connection:Keep-Alive Content-Length:75134 Content-Type:text/javascript; charset=UTF-8 Date:Fri, 12 Nov 2010 11:28:21 GMT Expires:Sat, 13 Nov 2010 11:28:21 GMT Keep-Alive:timeout=15, max=100 Last-Modified:Fri, 12 Nov 2010 11:16:53 GMT Pragma:cache Server:Oracle Application Server Containers for J2EE 10g (9.0.4.0.0) Transfer-Encoding:chunked </code></pre> <p>The response headers from Google's file are:</p> <pre><code>Age:119 Cache-Control:public, max-age=31536000 Content-Encoding:gzip Content-Length:26769 Content-Type:text/javascript; charset=UTF-8 Date:Fri, 12 Nov 2010 11:26:22 GMT Expires:Sat, 12 Nov 2011 11:26:22 GMT Last-Modified:Fri, 15 Oct 2010 18:25:24 GMT Server:sffe Vary:Accept-Encoding X-Content-Type-Options:nosniff </code></pre> <p>The content types now look the same to me.</p> <p>Any other ideas please?</p> <hr> <p><strong>SOLVED</strong> The problem was nothing at all to do with jquery, mime types, etc. It was our ant build file. There was a target in there (which we've had on this code for over 6 years) which tried to minimise any JS file using a regular expression search/replace. This was breaking the actual jQuery javascript file. D'oh!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload