pc端网站如何自动跳转到移动wap端网站

<script type="text/javascript">
    var uaTest = /Android|webOS|Windows Phone|iPhone|ucweb|ucbrowser|iPod|BlackBerry/i.test(navigator.userAgent.toLowerCase());
    var touchTest = 'ontouchend' in document;
    if (uaTest && touchTest) {
        window.location.href = '手机端网址;
    }    
    function AddFavorite(sURL, sTitle) {
        try {
            window.external.addFavorite(sURL, sTitle);
        } catch (e) {
            try {
                window.sidebar.addPanel(sTitle, sURL, "");
            } catch (e) {
                alert("加入收藏失败,请使用Ctrl+D进行添加");
            }
        }
    }
</script>

 

posted @ 2020-04-29 08:31  心无引擎,眼无流派  阅读(628)  评论(0编辑  收藏  举报