SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,656
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)

    how does thius work?

    http://james.padolsey.com/javascript...onal-comments/

    AKA how do I write the rules for ie?

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by EricWatson View Post
    http://james.padolsey.com/javascript...onal-comments/

    AKA how do I write the rules for ie?
    Browser detection has been attacked for many years as being a bad idea. Using feature detection instead is the much more preferred technique.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,656
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    That's not browser detection. It's using IE conditional comments. I just can't tell how to fire it.

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by EricWatson View Post
    That's not browser detection. It's using IE conditional comments. I just can't tell how to fire it.
    Ahh yes, conditional comments. Those aren't being used from IE10 onwards.

    We have details on them at http://www.sitepoint.com/microsoft-drop-ie10-conditional-comments/
    And you can see the IE page about them at Microsoft's About conditional comments


    If you're asking about how the code from the OP works, it's just adding an <I> element to the web page. The conditional comment will result in it being visible to the DOM when the IE version is greater than the specified number, at which point it can tell what version of IE is being used.

    I would stay away from such techniques though, due to the bad browser detection paradigm, and that it fails when conditional comments aren't supported, which applies to IE 10 and onwards.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


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
  •