How to display browser specific HTML?

后端 未结 9 674
遇见更好的自我
遇见更好的自我 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:39

    You could always use CSS to hide the code from specific browsers. For instance, considering the following code:

    click here!
    click here!
    

    You could apply the following CSS hacks, and the appropriate links would be displayed to the appropriate browsers.

    /* Display settings for most browsers */
    #ie-only {display: none;}
    #other-browsers {display: block;}
    
    /* Display settings for IE <= 6 */
    * html #ie-only {display: block;}
    * html #other-browsers {display: none;}
    

提交回复
热议问题