0

我使用以下脚本将移动用户重定向到移动网站:

<script type="text/javascript">
    if (screen.width < 800) {
        var ref = document.referrer;
        var urls = new Array("http://www.ilsanlorenzo.net","http://www.ilsanlorenzo.net/mobsite");
        var n = ref.match(urls[0]);
        var m = ref.match(urls[1]);
        if ((m!==null) || (n!==null)) {
            stop;
        } else if (ref=='') {
            var r = confirm("Small Display is Detected.\nClick \"OK\" for MOBILE SITE.");
            if (r==true) {
                window.location = "http://www.ilsanlorenzo.net/mobsite";
            } else {
                stop;
            }
        } else {
            window.location = "http://www.ilsanlorenzo.net/mobsite";
        }
    }
</script>

我想知道是否有人知道将移动用户重定向到移动网站版本以及将平板电脑和桌面用户重定向到网站版本的脚本。有谁知道解决方案?

谢谢你的时间!

4

0 回答 0