我的手机(魅族 MX2)工作正常。我不知道 Dolphin 浏览器的版本。你可以测试'screen.width'和'document.body.clientWidth'
我建议你可以这样写:
<script>
var userAgent = navigator.userAgent.toLowerCase();
checkOS = function (r) {
return r.test(userAgent);
};
var PlatformOS = {
isWindows: checkOS(/windows nt|win32/),
isMac: checkOS(/macintosh|mac os x/),
isAndroidPad: checkOS(/nexus 7|xoom /),
isAndroid: checkOS(/android/),
isIphone: checkOS(/iphone/),
isIpad: checkOS(/ipad/),
isWindowsPhone: checkOS(/windows phone/),
OS: "",
}
if (PlatformOS.isIpad || PlatformOS.isWindows || PlatformOS.isAndroidPad) {
location.href = "http://www.mywebsite.com.au/pc/";
}
else if (PlatformOS.isIphone||PlatformOS.isWindowsPhone) {
location.href = "http://www.mywebsite.com.au/mobile/";
}
window.onload = function () {
var currWidth = document.body.clientWidth;
if (currWidth >= 699)
location.href = "http://www.mywebsite.com.au/pc/";
else
location.href = "http://www.mywebsite.com.au/mobile/";
}
</script>