廢話不多說,直接上代碼
<script>
var __current_url_4_forward = window.location.href;
var __ua__4_forward=window.navigator.userAgent.toLowerCase();
if(__ua__4_forward.toLowerCase().indexOf("android")!=-1 || __ua__4_forward.toLowerCase().indexOf("iphone")!=-1 ||__ua__4_forward.toLowerCase().indexOf("ipad")!=-1 || __ua__4_forward.toLowerCase().indexOf("windows mobile")!=-1){
window.location.href = window.location.href.replace("cbook","mbook").replace("ccls","mcls").replace("https://www.","https://m.");
}
</script>
最後面的window.location.href.replace(“cbook”,”mbook”).replace(“ccls”,”mcls”).replace(“https://www.”,”https://m.”);可以考慮增添,方便運行
發布者:彬彬筆記,轉載請註明出處:https://www.binbinbiji.com/zh-hant/html5/2228.html