function mobileskip(url) {
        var mobileAgent = new Array("iphone", "ipod", "ipad", "android", "mobile", "blackberry", "webos", "incognito", "webmate", "bada", "nokia", "lg", "ucweb", "skyfire");
        var browser = navigator.userAgent.toLowerCase();//Navigator是HtmlDom中的内置对象,包含有关浏览器的信息,userAgent是Navigator的属性方法,可返回由客户机发送服务知器的 user-agent 头部的值,作用其实就是返回当前用户所使用的是什么浏览器
        var isMobile = false;//记录是否移动端
        for (var i=0; i<mobileAgent.length; i++){
            if (browser.indexOf(mobileAgent[i])!=-1){
                isMobile = true;
                location.href = url;
                break;
            }
        }
    }
var Mymobileskip = new mobileskip('https://www.bilibili.com');//传入需要跳转的地址

 

相关文章:

  • 2021-11-05
  • 2022-12-23
  • 2022-01-19
  • 2022-12-23
  • 2022-12-23
  • 2022-02-23
  • 2022-12-23
猜你喜欢
  • 2021-12-31
  • 2022-12-23
  • 2022-03-10
  • 2021-12-19
  • 2021-12-19
  • 2021-05-22
相关资源
相似解决方案