正在载入...


新建一个js 如 goto-m.js

function browserRedirect(url) {

var sUserAgent = navigator.userAgent.toLowerCase();

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";

if (bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM){

window.location.replace(url);

}

}


在网站<head>位置引入这个js

<script src='https://wentong.org/goto-m.js' language='javascript'></script>
<script type="text/javascript">
browserRedirect("https://m.wentong.org/");//移动站URL
</script>

本文链接:

关键词:JS, 互联网, 代码, 函数, 自动跳转,

(全文完        )

Comments

哈哈,沙发有木有?!!!抢沙发快速评论