Click here to see your recently viewed pages and most viewed pages.

Web Authoring Statistics: Scripting

The <script> element

The script element was used on roughly half the pages we checked. The most common attributes:

language, src, type, defer, charset, id, fptype, for, event, name, langauge, class, tppabs, langugage, and languaje.

There really is no reason for using language these days. It's been deprecated since forever, and quite obviously a lot of people can't spell it. And given that more than half of pages specify the type attribute anyway... this is probably mostly a matter of "just in case" cargo-cult authoring. (It's worth noting that in the current HTML5 proposals, the language attribute is gone, leaving only type, and that that is being made optional, defaulting to text/javascript.)

Lots of src: more than half the pages we examined apparently use external scripts somewhere.

That's it as far as popular attributes go. In the rarely-used bucket, we have mostly IE-specific things. The defer attribute, currently implemented only by IE (to our knowledge), is underdefined in HTML4. There have been proposals for dropping it in HTML5, but apparently it is used, so maybe instead the specification will have to describe what it actually means (exactly). The for and event attributes are IE extensions similar to XML Events (although simpler). It is interesting that they are used at all. fptype is a FrontPage extension.

It would be interesting (though quite hard) to examine the uses of charset to determine how many of them were wrong or redundant. The aforementioned proposals for HTML5 don't mention the charset attribute currently; if the attribute is used for good reason, though, it may have to be added.