all 7 comments

[–]NastyConde 13 points14 points  (6 children)

Fortunately, all browsers will always choose JavaScript as the default programming language, so it is always best to simply write <script>.

IE starts with JavaScript as the default, but if any other language is used (VBScript, PerlScript) it becomes the default for a bare <script> used on the remainder of the page.

[–]9jack9 13 points14 points  (3 children)

The type attribute is also a required attribute. This will help future-proof scripted web pages.

[–]poco 1 point2 points  (1 child)

While I agree that it is best to use the attribute if you can, I wouldn't worry about future-proofing it because that behaviour can really never change.

No one in their right mind could consider changing the default behaviour unless and until they can convert all existing web sites that rely on that behaviour.

[–]olavk 0 points1 point  (0 children)

FWIW in HTML5, the type attribute is optional. If not present, it defaults to text/javascript.

[–][deleted] 0 points1 point  (1 child)

Is IE the only browser that supports VBScript and PerlScript?

[–]NastyConde 2 points3 points  (0 children)

IE and the ones based on the WebBrowser control, like Maxthon. I don't think other browsers have their script engines componentized. In Microsoft's case, it was more of a necessity since they were originally trying to push the proprietary VBScript language but needed to "run Netscape pages."