Home >Web Front-end >JS Tutorial >Summary of methods to determine browser kernel and version number_jquery

Summary of methods to determine browser kernel and version number_jquery

WBOY
WBOYOriginal
2016-05-16 16:21:581307browse

Use jquery to determine the browser’s kernel and version number

Copy code The code is as follows:


通过浏览器版本信息判断各浏览器

复制代码 代码如下:

var _uat=navigator.userAgent;
if(_uat.indexOf("MSIE 6.0")>0) alert("ie6");
else if(_uat.indexOf("MSIE 7.0")>0) alert("ie7");
else if(_uat.indexOf("MSIE 8.0")>0) alert("ie8");
else if(_uat.indexOf("Firefox")>0) alert("firefox");

CSS判断浏览器

复制代码 代码如下:

#example{color:red ;} /*firefox*/
* html #example{color:blue;} /*ie6*/
* html #example{color:green;} /*ie7*/

HTML判断浏览器

复制代码 代码如下:

1. 除IE外都可识别
2.
3.
4.
5.
6.
7.
8.
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