The Html Script Tag And Non-js Content - Firefox
Solution 1:
Is there a some spec that says browsers should only process JavaScript related mime-types?
See the type attribute:
This attribute gives an advisory hint as to the content type of the content available at the link target address. It allows user agents to opt to use a fallback mechanism rather than fetch the content if they are advised that they will get content in a content type they do not support.
If you want to fetch arbitrary content for use in a script, use XMLHttpRequest.
Solution 2:
The canonical way to specify script is
<scriptsrc="something.js"type="text/javascript"></script>
or
<scriptsrc="somethingThatWilReturnJavaScriptMime.someextension"type="text/javascript"></script>
There is no reason the browser should load unknown mime into a script tag and it will be strictly browser specific whether or not it will allow/ignore the type attribute
It would be a matter of testing to see what the browser will do if you actually send
content-type:text/javascript
regardless of type attribute
Solution 3:
Are you setting the content type. Guessing .NET here so posting basic idea:
publicclassHandler : IHttpHandler {
publicvoidProcessRequest(HttpContext context){
context.Response.ContentType = "text/javascript";
context.Response.Write("alert('hello world');");
}
}
Post a Comment for "The Html Script Tag And Non-js Content - Firefox"