【发布时间】:2016-04-29 18:18:10
【问题描述】:
我正在开发一个 html 页面来检查流量是移动的还是桌面的。之后,如果是移动设备,它会重定向到“页面 A”,否则如果是桌面设备,它会重定向到“页面 B”。
目前我有此代码,但不适用于移动设备,重定向仅适用于桌面流量。
我该如何解决?
<html>
<head>
<script>if (typeof window.orientation == 'undefined' || len(navigator.plugins.length) > 0){
document.location.href='http://pageA';
}
else {
document.location.href='http://pageB';
}</script>
<title>My test</title>
</head>
<body>
</body>
</html>
【问题讨论】:
标签: javascript html redirect mobile desktop