SitePoint Sponsor

User Tag List

Results 1 to 12 of 12

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Jan 2001
    Location
    Ottawa ON
    Posts
    315
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why using <script type="text/javascript">

    Dreamweaver says that neither Netscape6 or Internet Explorer 6 support the type attribute of the script tag. The only reason that I ever included it was for validators. However, if none of the major browsers are picking it up, is there any non-pedantic point to using it in additional to language=""?

  2. #2
    SitePoint Addict
    Join Date
    Jul 2001
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It doesn't hurt any and may actually help to leave it in. I wouldn't go by what Dreamweaver "thinks" is right or wrong.

  3. #3
    SitePoint Enthusiast darkfires's Avatar
    Join Date
    Apr 2002
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, it sets the mimetype and in the event that the script tag can load other types of scripts besides text-based, it'll be needed. That's my take on it, anyway.

  4. #4
    SitePoint Addict
    Join Date
    Jan 2001
    Location
    Ottawa ON
    Posts
    315
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the responses.

    I now understand the theoretical basis for the tag.

    But I'll just use language since it is a much more specific tag (being able to specify script version as well as type)

  5. #5
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I use the type attribute all the time and it works just fine in N6 and IE6

    Sketch
    Aaron Brazell
    Technosailor



  6. #6
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <script type="text/javascript"></script>

    is valid xhtml whereas the language attribute has been dropped. So use the above and throw dreamweavers help file in the bin:P

    <script language="javascript" type="text/javascript"></script>

  7. #7
    That's Right. notepad_coder's Avatar
    Join Date
    Apr 2002
    Location
    Colorado
    Posts
    835
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    isnt it uase to tell scripts apart like >script type="text/VBScript></script>. I don't know for sure, I havn't done much in JavaScript or VBScript.
    - the lid is off the maple syrup again!

  8. #8
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    As was previously stated the type refers to MIME type and yes Netscape 6.22/Mozilla does understand this, as does Microsoft IE 6.0, for example; when adding CSS you might for instance use; type="text/css"

    The "language" attribute within <script> was designed to determine the scripting language, which by default is normally JavaScript that goes back to the early Netscape browsers.

    };-) http://www.xhtmlcoder.com/

  9. #9
    SitePoint Addict
    Join Date
    Jan 2001
    Location
    Ottawa ON
    Posts
    315
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually, from testing neither IE6 or Netscape6 do anything with the type attribute: you are just as weel to leave it on or off regardless of what scripting language you are using. IE6 will be just as happy with <script> no matter what language is inside the tags.

  10. #10
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    although for validation you need type in xhtml so its up to the person preferences, however it's a much better practice to type the language used

  11. #11
    long gone but not forgotten AljapaCo's Avatar
    Join Date
    Aug 2001
    Location
    Sweden
    Posts
    548
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <script language="javascript" type="text/javascript"></script>
    My way, all the day!!

    It might be the case that MSIE supports any crap thatīs out there, but if you wanīt your site to be viewable in as many different browsers as possible, I suggest you write it as the standard says!
    T O B I A S - S T R A N D H | visit my site here
    OPERA7 /MSIE6 /FireFox 1.1/Win2000 /ADSL /17" Screen /1024x768
    god doesn't create genius, he clones me.............

  12. #12
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    I would have to disagree a little with "neither IE6 or Netscape 6 do anything with the type attribute" some browsers may not do anything with the certain type attributes, and yes Micro$oft IE had a major security flaw because it ignored "type".

    Albeit it is especially useful for defining which specific helper application/program the browser uses to view the file.

    };-) http://www.xhtmlcoder.com/


Bookmarks

Posting Permissions

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