| Proper linking for external JavaScript files language is out; type is in |
tedster

msg:1482552 | 4:02 am on Jun 18, 2001 (gmt 0) | Apparently this change happened a while back, but I didn't catch it until recently, when I ran a few problem pages through the W3C validator. When linking to an external .js file, I always used the attribute language="JavaScript" in the script tag. This doesn't validate. The proper attribute is type="text/javascript". There are sources all over the web that still recommend the language attribute, so I'm not rushing to correct all my sites just now, but seems like that job must be done some day. (edited by: tedster on 9:20 am (gmt) on June 18, 2001)
|
chiyo

msg:1482553 | 4:38 am on Jun 18, 2001 (gmt 0) | Thanks Tedster. great advice.. We tend to use public domain js initially and adapt/extend them over the years. and yes hadn't notice that there was 2 ways of referring to js scripts in our code.
|
Xoc

msg:1482554 | 6:03 am on Jun 18, 2001 (gmt 0) | You should use both attributes. The language attribute is deprecated. The type attribute is the new one. Old browsers don't support the type attribute. A strict html 4.0, or xhtml 1.x page won't validate with the language attribute, but no browser really can do strict html since support for cascading style sheets is so bad. <edit>Fixed wording</edit> (edited by: Xoc at 4:17 pm (gmt) on July 14, 2001)
|
Rumbas

msg:1482555 | 8:15 am on Jun 18, 2001 (gmt 0) | Could you clarify this - I'm a bit slow ;) This is the linking I've always used: <script language=JavaScript src="file.js"></script> Change that to: <script type="text/javascript" src="file.js"></script>
|
tedster

msg:1482556 | 9:19 am on Jun 18, 2001 (gmt 0) | To accommodate old and current browsers, we should be using: <script type="text/javascript" language="JavaScript" src="file.js"></script> Thanks, Xoc.
|
Rumbas

msg:1482557 | 1:13 pm on Jun 18, 2001 (gmt 0) | Thanks guys :)
|
|
|