手机UA跳转至m子域名JS代码

请将此代码添加至全局——嵌入相关——模板加载前嵌入:

<script>
(function() {
if(window.screen.width < 1000 && location.hostname.split(\’.\’)[0] != \’m\’) {
location.href = \’http://m.afx5.cn\’ + location.pathname + location.search + location.hash;
}
})();
</script>

上述代码UC浏览器不跳转,请使用下列代码:

<script>
$(function() {
if($(window).width() < 1000 && location.hostname.split(\’.\’)[0] != \’m\’) {
location.href = \’http://m.afx5.cn\’ + location.pathname + location.search + location.hash;
}
})
</script>

请将上述代码中的http://m.afx5.cn替换为http://m.你的主域名

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

请登录后发表评论

    暂无评论内容