特别是一些单页HTML,网页不是自适应怎么怎么做跳转?
以下代码电脑打开不会跳,
手机打开会跳转指定页面
在头部代码<head>内加入以下:
<script>
try {
var urlhash = window.location.hash;
if (!urlhash.match("fromapp")) {
if ((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i))) {
window.location = "要跳的网页链接";
}
}
} catch (err) {} </script>
<style type="text/css">.nmm {
color: #ffffff;
}.per {
color: #CCC;
}</style>
本方法由919YY.com 发布