此代码我在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
暂无评论内容