<script type="text/javascript">
<!--
if (screen.width <= 699) {
document.location = "mobile.html";
}
//-->
</script>
“ mobile.html”将替换为您的移动版本所在的位置。 该技术也可以适用于加载替代样式表。
专门用于iPhone / iPod
<script language=javascript>
<!--
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
location.replace("http://url-to-send-them/iphone.html");
}
-->
</script>
翻译自: https://css-tricks.com/snippets/javascript/redirect-mobile-devices/