Home >php教程 >php手册 >jquery判断浏览器版本

jquery判断浏览器版本

WBOY
WBOYOriginal
2016-06-07 11:45:231587browse

jQuery 浏览器判断,jQuery提供了一个 jQuery.browser 方法 来判断浏览器版本
可用值:
  safari opera msie mozilla
下面是一个较为完整的例子:
  <br>   <br>   <meta> <br>   <title>无标题文档</title> <br>   <script></script><br>   <style><br />   *{ margin:0; padding:0;}<br />   body{ background:#eee;}<br />   .info{ width:600px; min-height:120px; _height:120px;<br />   line-height:120px; border:8px solid #f60; margin:40px auto;<br />   background:#fff; text-align:center; font-size:36px; font-weight:900;<br />   font-family:Arial, Helvetica, sans-serif; color:#d00;}<br />   </style> <br>   <script><br />   $(document).ready(function(){<br />   var bro=$.browser;<br />   var binfo="";<br />   if(bro.msie) {binfo="Microsoft Internet Explorer "+bro.version;}<br />   if(bro.mozilla) {binfo="Mozilla Firefox "+bro.version;}<br />   if(bro.safari) {binfo="Apple Safari "+bro.version;}<br />   if(bro.opera) {binfo="Opera "+bro.version;}<br />   alert(binfo);<br />   $("#browser").html(binfo);<br />   })<br />   </script><br>   <br>   <br>   <div> <br>   Browser Info<br>   </div> <br>   

AD:真正免费,域名+虚机+企业邮箱=0元

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn