数码资讯
Javascript判断页面访问计算机或移动端
方法1: 功能browserredirect(型){ 无功suseragent = navigator.useragent.tolowercase(); 无功bisipad = suseragent.match( / /我的iPad)= =iPad; 无功bisiphoneos = suserage
选购提示
关注价格、性能、续航、售后和真实使用场景,理性比较后再下单。
方法1:
功能browserredirect(型){
无功suseragent = navigator.useragent.tolowercase();
无功bisipad = suseragent.match( / /我的iPad)= =iPad;
无功bisiphoneos = suseragent.match( / /我的iPhone OS)= =iPhone OS;
无功bismidp = suseragent.match( / /我MIDP)= =MIDP ;
无功bisuc7 = suseragent.match( /右:1.2.3.4 /我)= =RV:1.2.3.4;
VaR胃必治= suseragent.match( / /我UCWEB)= =UCWEB;
无功bisandroid = suseragent.match( / Android /我)= =Android;
无功bisce = suseragent.match( / /我的Windows CE)= =CE;
无功biswm = suseragent.match( / /我的Windows Mobile)= =Windows手机;
如果(bisipad bisiphoneos bismidp bisuc7 | | | | | | | |胃必治| | bisandroid | | | | bisce biswm){
窗口的位置。href = / / / rhylogin ctcshop shtml;
(这是一个手机);
{人}
窗口位置= ' /易/登录。shtmlref_url = / /索引HTML/;
(这是一台计算机);
}
}
1 /方法:
函数的IsPC(){
无功useragentinfo = navigator.useragent;
var代理=Android
SymbianOS
iPad
var标志=真;
对于(var v = 0;V<agents.length;V + +){
如果(useragentinfo.indexof(代理{五})> 0){
标志=假;
打破;
}
}
返回标志;
}
方法2:
功能browserredirect(){
无功suseragent = navigator.useragent.tolowercase();
无功bisipad = suseragent.match( / /我的iPad)= =iPad;
无功bisiphoneos = suseragent.match( / /我的iPhone OS)= =iPhone OS;
无功bismidp = suseragent.match( / /我MIDP)= =MIDP ;
无功bisuc7 = suseragent.match( /右:1.2.3.4 /我)= =RV:1.2.3.4;
VaR胃必治= suseragent.match( / /我UCWEB)= =UCWEB;
无功bisandroid = suseragent.match( / Android /我)= =Android;
无功bisce = suseragent.match( / /我的Windows CE)= =CE;
无功biswm = suseragent.match( / /我的Windows Mobile)= =Windows手机;
如果(!(bisipad bisiphoneos bismidp bisuc7 | | | | | | | |胃必治| | bisandroid | | | | bisce biswm)){
窗口的位置。href = B页;
}
}
BrowserRedirect();
方法3:
var浏览器{ {
版本:函数(){
VaR U = navigator.useragent,程序= navigator.appversion;
返回移动终端浏览器版本信息
三叉戟:u.indexof('trident)> 1, / / IE内核
Presto:u.indexof('presto)> 1, / /歌剧内核
Webkit:u.indexof('applewebkit)> 1,苹果、谷歌/内核
壁虎:u.indexof('gecko)> 1 u.indexof('khtml)= 1,Firefox /内核
移动:!!u.match( / applewebkit移动。*。* /)
| |!!u.match( / / / applewebkit),或是否为移动终端
iOS:u.match!((i;};};+;(u;CPU + Mac)操作系统);
安卓:u.indexof('android)- 1 u.indexof('linux)| | > > 1, / / Android终端或UC浏览器
iPhone:u.indexof('iphone)- 1 u.indexof('陆委会')| | > > / / 1,无论是iPhone或qqhd浏览器
iPad:u.indexof('ipad)- 1 / iPad >,是否
应用:u.indexof('safari)= 1 / /网页,程序是否应该,没有头部和底部
暗送秋波:u.indexof('chrome)> 1
};
(}),
语言:(导航。browserlanguage)。ToLowerCase(navigator.language | |)
}
document.writeln(语言版本:+浏览器。语言);
document.writeln(是移动终端:+浏览器版本。移动);
以上是判断页面的方式,对数据进行整理整理,跟进,继续补充相关信息,谢谢各位站的支持!
功能browserredirect(型){
无功suseragent = navigator.useragent.tolowercase();
无功bisipad = suseragent.match( / /我的iPad)= =iPad;
无功bisiphoneos = suseragent.match( / /我的iPhone OS)= =iPhone OS;
无功bismidp = suseragent.match( / /我MIDP)= =MIDP ;
无功bisuc7 = suseragent.match( /右:1.2.3.4 /我)= =RV:1.2.3.4;
VaR胃必治= suseragent.match( / /我UCWEB)= =UCWEB;
无功bisandroid = suseragent.match( / Android /我)= =Android;
无功bisce = suseragent.match( / /我的Windows CE)= =CE;
无功biswm = suseragent.match( / /我的Windows Mobile)= =Windows手机;
如果(bisipad bisiphoneos bismidp bisuc7 | | | | | | | |胃必治| | bisandroid | | | | bisce biswm){
窗口的位置。href = / / / rhylogin ctcshop shtml;
(这是一个手机);
{人}
窗口位置= ' /易/登录。shtmlref_url = / /索引HTML/;
(这是一台计算机);
}
}
1 /方法:
函数的IsPC(){
无功useragentinfo = navigator.useragent;
var代理=Android
SymbianOS
iPad
var标志=真;
对于(var v = 0;V<agents.length;V + +){
如果(useragentinfo.indexof(代理{五})> 0){
标志=假;
打破;
}
}
返回标志;
}
方法2:
功能browserredirect(){
无功suseragent = navigator.useragent.tolowercase();
无功bisipad = suseragent.match( / /我的iPad)= =iPad;
无功bisiphoneos = suseragent.match( / /我的iPhone OS)= =iPhone OS;
无功bismidp = suseragent.match( / /我MIDP)= =MIDP ;
无功bisuc7 = suseragent.match( /右:1.2.3.4 /我)= =RV:1.2.3.4;
VaR胃必治= suseragent.match( / /我UCWEB)= =UCWEB;
无功bisandroid = suseragent.match( / Android /我)= =Android;
无功bisce = suseragent.match( / /我的Windows CE)= =CE;
无功biswm = suseragent.match( / /我的Windows Mobile)= =Windows手机;
如果(!(bisipad bisiphoneos bismidp bisuc7 | | | | | | | |胃必治| | bisandroid | | | | bisce biswm)){
窗口的位置。href = B页;
}
}
BrowserRedirect();
方法3:
var浏览器{ {
版本:函数(){
VaR U = navigator.useragent,程序= navigator.appversion;
返回移动终端浏览器版本信息
三叉戟:u.indexof('trident)> 1, / / IE内核
Presto:u.indexof('presto)> 1, / /歌剧内核
Webkit:u.indexof('applewebkit)> 1,苹果、谷歌/内核
壁虎:u.indexof('gecko)> 1 u.indexof('khtml)= 1,Firefox /内核
移动:!!u.match( / applewebkit移动。*。* /)
| |!!u.match( / / / applewebkit),或是否为移动终端
iOS:u.match!((i;};};+;(u;CPU + Mac)操作系统);
安卓:u.indexof('android)- 1 u.indexof('linux)| | > > 1, / / Android终端或UC浏览器
iPhone:u.indexof('iphone)- 1 u.indexof('陆委会')| | > > / / 1,无论是iPhone或qqhd浏览器
iPad:u.indexof('ipad)- 1 / iPad >,是否
应用:u.indexof('safari)= 1 / /网页,程序是否应该,没有头部和底部
暗送秋波:u.indexof('chrome)> 1
};
(}),
语言:(导航。browserlanguage)。ToLowerCase(navigator.language | |)
}
document.writeln(语言版本:+浏览器。语言);
document.writeln(是移动终端:+浏览器版本。移动);
以上是判断页面的方式,对数据进行整理整理,跟进,继续补充相关信息,谢谢各位站的支持!
声明:本文内容用于数码产品信息整理与选购参考,具体价格、库存、售后政策以官方渠道和电商页面实时信息为准。