ITPub博客

首页 > 人工智能 > 深度学习 > 大象跳转良心提供在微信中点击链接直接跳转到手机默认浏览器的功能代码

大象跳转良心提供在微信中点击链接直接跳转到手机默认浏览器的功能代码

原创 深度学习 作者:wsx000 时间:2019-05-29 22:20:30 0 删除 编辑

源码使用场景:

1、用来实现微信自动跳转外部浏览器下载app
2、用来实现微信内打开网页链接自动跳转浏览器访问指定页面
3、防止网页链接由于被微信拦截,导致用户无法正常在微信内打开


源码说明:

适用安卓和苹果系统,支持任何网页链接。并且无论链接是否已经被微信拦截,均可实现微信内自动跳转浏览器打开。

生成的跳转链接具有极佳的防拦截效果。

<!DOCTYPE html>
<html xmlns="http://www.go51w.cn/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>loading</title>
        <script type=text/javascript src="http://libs.baidu.com/jquery/1.9.0/jquery.min.js"></script>
    </head>
    
    <body>
        
        
    <script type="text/javascript">
        $(function () {
            get_share();
        });
        
        function get_share(){
            var user = getQueryString('user');
            var url = getQueryString('url');
            $.ajax({
             type: "get",
             async: false,
             url: 'http://api.weixin139.com/jumpurl/index/get_url.html',
             data:{user:user,url:url},
             dataType: "jsonp",
             jsonp: "callback",
             jsonpCallback:"checkHandler",
             success: function(data){
                 window.location.href=data.url;
             },
         });
        }
        
        function getQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]);
            return null;
        }
 
        </script>
 
    </body>
</html>


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69926239/viewspace-2646134/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2019-05-29

  • 博文量
    5
  • 访问量
    6730