在需要跳转的PC网站的网页<head>区域上加入如下代码,如果是移动端访问的话,就跳转到相应的移动端网页。
<script type="text/javascript">
try {
var urlhash = window.location.hash;
if (!urlhash.match("fromapp")) {
if ((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i))) {
window.location = "http://m.59178.com/";
}
}
}
catch (err) {
}
</script>