真的很简单。
如果(navigator.useragent.indexof('ucbrowser)> 1){
警报(UC
浏览器);
{ }人
/不是UC浏览器
操作 }
如果您想测试浏览器的特性,可以通过以下
方法获得
js访问浏览器信息
浏览器的代码名称:navigator.appcodename
浏览器名称:navigator.appname
浏览器版本号:navigator.appversion
支持java:navigator.javaenabled()
MIME
类型(数组):navigator.mimetypes
系统平台:navigator.platform
插件(阵列):navigator.plugins
用户代理:navigator.useragent
更完整的
document.write('browser歧视);
无功osobject = navigator.useragent;
包含Opera
文本列
如果(OsObject.indexOf(歌剧)!= 1)
{
document.write(浏览器是歌剧吗);
}
/ /包含MSIE文本列
如果(OsObject.indexOf(MSIE)!= 1)
{
document.write(你的浏览器是Internet Explorer,不是吗);
}
包含铬列的文本,但也
复制铬UA浏览器360
如果(OsObject.indexOf(铬)!= 1)
{
document.write(你的浏览器是Chrome或360浏览器;
}
/ / ucbrowser包含文本列
如果(OsObject.indexOf(ucbrowser )!= 1)
{
document.write(浏览器是UCBrowser吗);
}
/ / bidubrowser包含文本列
如果(OsObject.indexOf(bidubrowser )!= 1)
{
document.write(你的浏览器是百度浏览器吗);
}
Firefox文本列
如果(OsObject.indexOf(火狐)!= 1)
{
document.write(你的浏览器是Firefox吗);
}
包含Netscape文本列
如果(OsObject.indexOf(网景)!= 1)
{
document.write(你的浏览器是Netscape吗);
}
包含Safari文本列
如果(OsObject.indexOf(狩猎)!= 1)
{
document.write(浏览器Safari吗);
}
别的{
document.write('unrecognized浏览器。);
}
现在很多浏览器
都是基于Chrome浏览器、360浏览器、猎豹浏览器等。