Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2005
    Posts
    549

    What's with the HTML comment tags in <script></script>?

    I see a lot of sites writing this:

    Code:
    <script type="text/javascript">
    <!--
    window.location = "http://www.google.com/"
    //-->
    </script>
    Why not just
    Code:
    <script type="text/javascript">
    window.location = "http://www.google.com/"
    </script>

  2. #2
    Join Date
    Aug 2005
    Location
    UK
    Posts
    654
    Its from the days where some browsers didn't support the script tag. Without the comment tags they would render the script as html, thus the end user would see
    Code:
    window.location = "http://www.google.com/"
    on the actual page.

  3. #3
    Xeentech is right, myself I don't use them because, well, if anyone doesn't have Javascript support in their browser they really shouldn't bother using the internet.

Posting Permissions

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