手机和电脑端分开跳转

 <title>我的第一个 HTML 页面</title>


<script type="text/javascript">
    var mobileAgent = new Array("iphone", "ipod", "ipad", "android", "mobile", "blackberry", "webos", "incognito", "webmate", "bada", "nokia", "lg", "ucweb", "skyfire");


    var browser = navigator.userAgent.toLowerCase();


    var isMobile = false;


    for (var i = 0; i < mobileAgent.length; i++) {


        if (browser.indexOf(mobileAgent[i]) != -1) {
            isMobile = true;
            alert("我要去手机适配的页面咯~");
            // location.href = 'app.html';   //匹配到就跳转到适配手机的html


            break;
        }
    }
    alert("我要去web页面咯~");
    //location.href = web.jsp';  //这里调到服务端
</script>




    把注释去掉,配上自己相应的路径就能跳转哦

猜你喜欢

转载自blog.csdn.net/a1214624851/article/details/77872072