<script>
if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
window.location.href =window.location.href.replace("www","m");
} else if (/(Android)/i.test(navigator.userAgent)) {
window.location.href =window.location.href.replace("www","m");
}
</script>
代码判断了当前环境的UA,如果是移动端,则将当前域名的www替换成m
网友评论