I inherited an ancient codebase that includes pages with <script type="text/jscript"> — yes, my life really does suck that much. The script appears to do nothing in modern, decent browsers (FF and Chrome, for a start) and I’m wondering if the stated script type is causing it to be ignored. I spent some time trying to figure out what’s going on, and I see things like
As explained by JavaScript guru Douglas Crockford in his talk entitled The JavaScript Programming Language on YUI Theater, “[Microsoft] did not want to deal with Sun about the trademark issue, and so they called their implementation JScript. A lot of people think that JScript and JavaScript are different but similar languages. That’s not the case. They are just different names for the same language, and the reason the names are different was to get around trademark issues.”
on Wikipedia. So Javascript == JScript? But then, I see conflicting information, like this answer which seems to suggest that script that’s declared as JScript will only run in IE.
So: can I just change the type tag and everything will work fine? Is there a simple process for conversion? If not, I may just scrap the whole thing and start over.
JScript is what Microsoft calls JavaScript
That doesn’t conflict. It just means that other browsers don’t recognise the mime type.
Browsers will ignore script elements with a type they do not recognise.
text/jscriptis non-standard and most browsers don’t recognise it (Internet Explorer considers it an alias fortext/javascript).Probably. The script might depend on other proprietary Microsoft—isms (such as
document.all) or other non-standard behaviour (automaticidattribute to JS global conversion or treating CSS lengths that are missing a unit as pixels) though.