View Full Version : More than one way to link a js file?

06-18-2008, 09:02 PM
Is there more than one way to link to an external js file in the head of an (X)HTML document?

I know about this way:

<script type="text/javascript" src="js/file.js"></script>

...but can this be made to work?

<link href="js/file.js" type="text/javascript" media="screen"/>

06-18-2008, 11:38 PM
No, that's not possible. The only alternative would be a server side include, but why use an alternative method when you can just use <script src="..."></script>?

06-19-2008, 02:13 PM
why use an alternative method ... ?

...So I can make use of the media attribute of the <link> tag to disable the script when printing. It's throwing my page's alignment off. But I'll just have to figure out another way...