移动端和PC端有两套代码需要转化的时候,可以在js里面写下面代码实现自动转化
var is_mobi = navigator.userAgent.toLowerCase().match(/(ipod|iphone|android|coolpad|mmp|smartphone|midp|wap|xoom|symbian|j2me|blackberry|wince)/i) != null;
pc端里面写
if (is_mobi) {
window.location.href = "phone.html";(移动端页面的相对位置)
window.location.href = "#";
}else{
window.location.href=webroot+murl;
window.location.href="index.html";
}
移动端里面写
if (is_mobi) {
window.location.href = "#";
}else{
window.location.href="index.html";
}