//产品页面,PC和手机端的要做自动跳转功能 (function(){ var list = [["http://www.taizile.net/product_zx2023.htm","/product/p_zx2023.htm"],["http://www.taizile.net/product_bwlr2023.htm","/product/p_bwlr2023.htm"],["http://www.taizile.net/product_bwzz2023.htm","/product/p_bwzz2023.htm"],["http://www.taizile.net/product_bwzh2023.htm","/product/p_bwzh2023.htm"],["http://www.taizile.net/product_lh2023.htm","/product/p_lh2023.htm"],["http://www.taizile.net/product_zy2023.htm","/product/p_zy2023.htm"],["http://www.taizile.net/product_zn2023.htm","/product/p_zn2023.htm"],["http://www.taizile.net/product_ycf.htm","/product/p_ycf.htm"],["http://www.taizile.net/product_gg.htm","/product/p_gg.htm"],["http://www.taizile.net/product_zln.htm","/product/p_zln.htm"],["http://www.taizile.net/product_stu.htm","/product/p_student.htm"],["http://www.taizile.net/product_childnew.htm","/product/p_childnew.htm"],["http://www.taizile.net/product_znet.htm","/product/p_znet.htm"]]; var local_url = document.URL.toLowerCase(); if (local_url.indexOf("?") != -1) { //剔除参数 local_url = local_url.substr(0, local_url.indexOf("?")); } var pcFindMobile=function(pc_url) { for (var i = 0; i < list.length; i++) { if (list[i][0] == pc_url) { return "https://m.taizile.net" + list[i][1]; } } return ""; } var mobileFindPC=function(mobile_url) { for (var i = 0; i < list.length; i++) { if (("https://m.taizile.net"+list[i][1] )== mobile_url) { return list[i][0]; } } return ""; } var isPC=function() { var sUserAgent = navigator.userAgent.toLowerCase(); var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os"; var bIsMidp = sUserAgent.match(/midp/i) == "midp"; var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4"; var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb"; var bIsAndroid = sUserAgent.match(/android/i) == "android"; var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce"; var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile"; //document.writeln("您的浏览设备为:"); if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) { console.log("mobile"); return false; } else { console.log("PC"); return true; } } if (isPC()) { if (local_url.startsWith("https://m.taizile.net/product/p_")) { //PC打开手机端页面的,查找对应的PC地址 var pc_url = mobileFindPC(local_url); if (pc_url != "") { location = pc_url; //跳到对应的手机页面取 } } } else { if (local_url.startsWith("https://www.taizile.net/product_")) { //手机打开PC端页面的,查找对应的手机端地址 var mobile_url = pcFindMobile(local_url); if (mobile_url != "") { location = mobile_url; //跳到对应的手机页面取 } } } })();