js判断在微信内置浏览器/QQ浏览器/百度浏览器/UC浏览器/火狐浏览器/谷歌浏览器上显示或跳转不同页面内容

 此代码我在PC和手机端测试过了都没问题

js判断浏览器的语言选择不同的页面

<script>
var wn=window.navigator;
var href=location.href;
if ((wn.systemLanguage=="zh-cn" || wn.language=="zh-CN") && href.indexOf("id=191")==-1) {
window.location = "https://www.xgwlgzs.cn/";
}
else if ((wn.systemLanguage=="en" || wn.language=="zh-EN") && href.indexOf("id=471")==-1) {
window.location = "https://www.xgwlgzs.cn/en";
}
</script>

 

js判断是在微信内置浏览器打开的,就跳转指定页面

<script>
$(window).on("load",function(){
var winHeight = $(window).height();
function is_weixin() {
var ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger") {
return true;
} else {
return false;
}
}
var isWeixin = is_weixin();
if(isWeixin){
location.href = "/home/jz.html"; //指定路径
}
})
</script>

 

js判断不在微信内置浏览器打开的,就跳转指定页面

<script>
$(function(){
var useragent = navigator.userAgent;
if (useragent.match(/MicroMessenger/i) != 'MicroMessenger') {
window.location.href = "/home/index.php"; //指定路径
}
})
</script>

 

js判断是在QQ浏览器上打开的,就跳转指定页面

<script>
$(window).on("load",function(){
var winHeight = $(window).height();
function is_QQ() {
var ua = navigator.userAgent.toLowerCase();
if (ua.match(/QQ/i) == "qq") {
return true;
} else {
return false;
}
}
var isQQ = is_QQ();
if(isQQ){
location.href = "/home/jz.html"; //指定路径
}
})
</script>

 

js判断是在UC浏览器上打开的,就跳转指定页面

<script>
$(window).on("load",function(){
var winHeight = $(window).height();
function is_UC() {
var ua = navigator.userAgent.toLowerCase();
if (navigator.userAgent.indexOf('UCBrowser') > -1) {
return true;
} else {
return false;
}
}
var isUC = is_UC();
if(isUC){
location.href = "/home/jz.html"; //指定路径
}
})
</script>

 

js判断是在百度浏览器上打开的,就跳转指定页面

<script>
$(window).on("load",function(){
var winHeight = $(window).height();
function is_baidu() {
var ua = navigator.userAgent.toLowerCase();
if (sUserAgent.indexOf(“baidu”) > 0) {
return true;
} else {
return false;
}
}
var isbaidu = is_baidu();
if(isbaidu){
location.href = "/home/jz.html"; //指定路径
}
})
</script>

 

js判断是在谷歌浏览器上打开的,就跳转指定页面

<script>
$(window).on("load",function(){
var winHeight = $(window).height();
function is_baidu() {
var ua = navigator.userAgent.toLowerCase();
if (navigator.userAgent.indexOf('Chrome') > -1) {
return true;
} else {
return false;
}
}
var isbaidu = is_baidu();
if(isbaidu){
location.href = "/home/jz.html"; //指定路径
}
})
</script>

 

js判断是在火狐浏览器上打开的,就跳转指定页面

<script>
$(window).on("load",function(){
var winHeight = $(window).height();
function is_baidu() {
var ua = navigator.userAgent.toLowerCase();
if (navigator.userAgent.indexOf('Firefox') > -1) {
return true;
} else {
return false;
}
}
var isbaidu = is_baidu();
if(isbaidu){
location.href = "/home/jz.html"; //指定路径
}
})
</script>

 

© 版权声明
THE END
喜欢就支持一下吧
点赞0
分享
评论 抢沙发
  • ZSBT666

    昵称

  • 取消
    昵称