首页 > 如何通過點擊鏈接實現加微信

如何通過點擊鏈接實現加微信

現在在做一個網站,想讓手機用戶訪問時,可以通過點擊一張圖片加我們的微信。到處找了沒發現微信有這樣的協議。不知有沒有人做個類似東西?


可以通过链接直接打开啊。比如你的二维码名片,实际上是一段url。在手机浏览器里面打开这段url就可以打开微信进入关注页了。之前有试过,不知现在微信是否屏蔽了这一方式。


点击链接加微信的实现: 只需要把你的微信二维码里的Url提取出来放在页面里做个链接就可以了,也就是类似http://weixin.qq.com/r/Eb1xaaTEFflqreAK9_gD这样的url。

==============================================================

扫微信名二维码打开微信app原理:

步骤1:

访问http://weixin.qq.com/r/Eb1xaaTEFflqreAK9_gD

会跳转到weixin://qr/Eb1xaaTEFflqreAK9_gD,如果装了微信app的话,则会打开微信。此时手机转到微信,然后浏览器(已在后台)访问决定微信下载地址的接口

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html;charset=gb2312"/>
</head>
<body>
<script>                    
        window.location = "weixin://qr/Eb1xaaTEFflqreAK9_gD";

        setTimeout( function(){
    if(navigator.language == "zh-CN" || navigator.userLanguage == "zh-CN"){
      window.location="http://weixin.qq.com/cgi-bin/readtemplate?check=false&t=weixin_getdownurl_sms&s=download&from=100&stype=10037102";
    }
    else{
      window.location = "http://wechat.com/cgi-bin/readtemplate?t=market_redirect";
    }
  } , 1500);
</script>

</body>

</html>

步骤2: 访问:http://wechat.com/cgi-bin/readtempalte?t=market_redirect

<html>
<head>
    <meta http-equiv="refresh" content="0; url=/cgi-bin/download302?fr=wechat.com&amp;url=ios&amp;cl=mobile">
</head>
<body></body>
</html>

用页面自刷新实现跳转(后台可能根据agent决定是android还是ios)

步骤3:

访问http://wechat.com/cgi-bin/download302?fr=wechat.com&url=ios&cl=mobile

302重定向到http://itunes.apple.com/app/id414478124?mt=8&ls=1

iOS会自动打开appstore的微信下载页面


微信官方不提供此类的添加方式

建议使用点击弹出二维码让用户扫描添加关注的功能

【热门文章】
【热门文章】