Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder BoldUlysses's Avatar
    Join Date
    Jan 2008
    Location
    Winston-Salem, NC
    Posts
    938
    Thanks
    10
    Thanked 190 Times in 187 Posts

    More than one way to link a js file?

    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:

    Code:
    <script type="text/javascript" src="js/file.js"></script>
    ...but can this be made to work?

    Code:
    <link href="js/file.js" type="text/javascript" media="screen"/>
    Last edited by BoldUlysses; 06-19-2008 at 02:14 PM.

  • #2
    Regular Coder
    Join Date
    Sep 2007
    Location
    AZ, USA
    Posts
    685
    Thanks
    6
    Thanked 46 Times in 46 Posts
    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>?

  • #3
    Regular Coder BoldUlysses's Avatar
    Join Date
    Jan 2008
    Location
    Winston-Salem, NC
    Posts
    938
    Thanks
    10
    Thanked 190 Times in 187 Posts
    Quote Originally Posted by binaryWeapon View Post
    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...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •