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