2012年10月24日 星期三

[HTML][Different Web Browser] How to determine the different Web Browser and use different method


[HTML][Different Web Browser] How to determine the different Web Browser and use different method





1. using [if !IE] determine IE browser.

2. using JavaScript determine FireFox or Chrome




<html>

<!--[if !IE]><!--><body id="top" onload="init();"><!--<![endif]-->

<!--[if IE 9]><body class="ie9" id="top" onload="init();"><![endif]-->

<!--[if IE 8]><body class="ie8" id="top" onload="init();"><![endif]-->

<!--[if IE 7]><body class="ie7" id="top" onload="init();"><![endif]-->

<!--[if lt IE 7]><body id="top" onload="init();"><![endif]-->

 

<script type="text/javascript">

    if (navigator.userAgent.toLowerCase().indexOf('chrome')!=-1){

      alert('happy')

    }else

    {

      alert('happy1')

    }  

</script>



</body>

</html>


Related Posts:

0 意見:

張貼留言