废话不多说,直接上代码
<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/html5/2228.html