1.对非手机端页面,判断。
<script>
function uaredirect(murl){
try{
if(document.getElementById("bdmark") != null) {
return
}
var urlhash = window.location.hash;
if(!urlhash.match("fromapp")){
if((navigator.userAgent.match(/(iPhone|Android|ios|webOS|iPod|BlackBerry)/i))){
location.replace(murl);
}
}
}catch(err){}
}
uaredirect("http://xxxx.xxxx.com/m_index.html");
</script>
当为手机终端时页面跳转到手机端页面
2.对手机端页面
<script>
function uaredirect(murl){
try{
if(document.getElementById("bdmark") != null) {
return
}
var urlhash = window.location.hash;
if(!urlhash.match("fromapp")){
if(!(navigator.userAgent.match(/(iPhone|Android|ios|webOS|iPod|BlackBerry)/i))){
location.replace(murl);
}
}
}catch(err){}
}
uaredirect("http://xxxx.xxxxx.com/indexhtml");
</script>
当终端为手机端页面时,跳转到手机端页面
完