當前位置:編程學習大全網 - 編程軟體 - 網頁代碼如何判斷瀏覽器跳轉到不同網站?

網頁代碼如何判斷瀏覽器跳轉到不同網站?

代碼判定安卓系統還是IOS跳轉到不同的頁面地址:

<script>

var u = navigator.userAgent;

var num_sing1 = 0;

var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1;

var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);

$("#imgTc").click(function(){

num_sing1++;

if(isAndroid){

if(num_sing1>1){

window.location.replace("/算命 www.fs58.com");

}else{

_ai_analysis(['trackEvent', 'button', 'download'],function() {

alert(11)

window.location.replace("/算命www.fs58.com ");

})

}

}

if(isiOS){

if(num_sing1>1){

window.location.replace("算命m.fs58.com ");

}else{

_ai_analysis(['trackEvent', 'button', 'download'],function(){

alert(22)

window.location.replace("算命m.fs58.com ");

});

}

}

if (is_weixn()) {

alert("請點擊右上角按鈕, 點擊使用瀏覽器打開");

}

function is_weixn(){

var ua = navigator.userAgent.toLowerCase();

if(ua.match(/MicroMessenger/i)=="micromessenger") {

return true;

} else {

return false;

}

}

});

</script>

100%可用已經過測試!

  • 上一篇:註射泵的註射泵的特點
  • 下一篇:計算機二級c語言程序設計有哪些題型?
  • copyright 2024編程學習大全網