How to display browser specific HTML?

后端 未结 9 670
遇见更好的自我
遇见更好的自我 2020-12-06 10:48

I\'m trying to find a way to display one link to an IE user and another link to all other browsers using javascript or conditional comments (or whatever it takes).

B

9条回答
  •  心在旅途
    2020-12-06 11:25

    This is the Microsoft-approved way:

    
    
        click here!
    
    

    More information available at http://msdn.microsoft.com/en-us/library/ms537512(VS.85).aspx.

    Edit

    This code is implicitly guaranteed to work in all current and future versions of IE starting with IE 5. For non-IE browsers, the code works by relying on those browsers ignoring the "nonsensical" tag, which they all do, and I've never seen it fail. For a version that uses nothing but good ol' HTML comments, see bobince's answer, which I actually prefer to the Microsoft-provided solution.

提交回复
热议问题