Loading a non-JavaScript file with a script tag results in a misleading message




12 years ago
6 months ago


(Reporter: jason.barnabe, Unassigned)



Firefox Tracking Flags

(Not tracked)





12 years ago
A <script> tag that refers to an HTML file in its src attribute produces an error as if it was trying to parse the HTML as XML. For example, loading google.com in a script tag gives 

Error: missing = in XML attribute
Source File: http://google.com/
Line: 6, Column: 13
Source Code:
<script defer>

This is misleading - making the file valid XML doesn't help in this situation. The error should instead say something about the file not being JavaScript.

Comment 1

12 years ago
How is it supposed to figure out that the file isn't JavaScript?  I guess there could be a warning about the text/html mime type before the parse error.

Comment 2

12 years ago
Yes, I was thinking by the MIME type. Do we try to parse the content regardless of the MIME type? If not, just say something about the MIME type. If so, the generic "Error loading script" that it gives when the server doesn't respond would be preferable to an XML parsing error.

See also bug 370583.


11 years ago
Component: DOM: HTML → DOM: Core & HTML
QA Contact: ian → general
Assignee: general → nobody

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.