網頁里打開微信或者qq


一,H5端:

手機端:

<a href="mqqwpa://im/chat?chat_type=wpa&uin=840937370&version=1&src_type=web&web_src=oicqzone.com">打開qq聊天框</a>

<a href="weixin://profile/CESVjbDE9e2KrfTu9xEa">微信方法二-瀏覽器中打開</a>
<a href="weixin://qr/CESVjbDE9e2KrfTu9xEa">微信方法三-瀏覽器中打開</a>
<a href="https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=YHWno5vEoVPdKd-AbyDk==&scene=110==#wechat_redirect">微信方法四-微信中打開窗口</a>

PC端:

<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&amp;uin=840937370&amp;site=qq&amp;menu=yes"> QQ</a>

<a href="tencent://message/?uin=840937370&Site=Sambow&Menu=yes">QQ</a>

 

<a href="https://qm.qq.com/cgi-bin/qm/qr?k=qQ2eY_xca3Q_Eks57x9Gh-dtSUVzuZ_K&authKey=fBfHpGZYecH6NxVbH%2B%2B55AdP2fucjyWuNlB9sGYPgidOzM3eVe5vJXW57%2BuiYLlG&noverify=0&group_code=832929820">QQ群</a>

二,js端:

 1 <!doctype html>
 2 <html>
 3 <head>
 4 <meta charset="utf-8">
 5 <title>手機與電腦瀏覽器打開qq或微信客服</title>
 6         <script type="text/javascript">
 7             // 跳轉到qq
 8             function openQQ(){  9                 var sUserAgent = navigator.userAgent.toLowerCase(); 10                 var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; 11                 var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os"; 12                 var bIsMidp = sUserAgent.match(/midp/i) == "midp"; 13                 var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4"; 14                 var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb"; 15                 var bIsAndroid = sUserAgent.match(/android/i) == "android"; 16                 var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce"; 17                 var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile"; 18                 if(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) { 19  window.open("mqqwpa://im/chat?chat_type=wpa&uin=840937370&version=1&src_type=web&web_src=oicqzone.com"); 20  } else { 21  window.open("tencent://message/?uin=840937370&Site=Sambow&Menu=yes"); 22  } 23  } 24             
25             // 跳轉到微信
26             function openWeChat(){ 27                 var sUserAgent = navigator.userAgent.toLowerCase(); 28                 var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; 29                 var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os"; 30                 var bIsMidp = sUserAgent.match(/midp/i) == "midp"; 31                 var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4"; 32                 var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb"; 33                 var bIsAndroid = sUserAgent.match(/android/i) == "android"; 34                 var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce"; 35                 var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile"; 36                 if(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) { 37  window.open("weixin://profile/CESVjbDE9e2KrfTu9xEa"); 38  } else { 39  window.open("https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=YHWno5vEoVPdKd-AbyDk==&scene=110==#wechat_redirect"); // 我不會打開電腦端窗口,這里用的在微信瀏覽器里打開的,有會的告訴我下。 40  } 41  } 42         </script>
43 </head>
44 
45 <body>
46     <div>
47         <a href="mqqwpa://im/chat?chat_type=wpa&uin=840937370&version=1&src_type=web&web_src=oicqzone.com" class="qq">手機QQ</a>
48         <a href="tencent://message/?uin=840937370&Site=Sambow&Menu=yes">電腦QQ</a>
49         
50         <a id="qq" href="javascript:void(0);" onclick="openQQ()">QQjs</a>
51         
52         <a href="weixin://profile/CESVjbDE9e2KrfTu9xEa">手機微信</a>
53         
54         <a id="WeChat" href="javascript:void(0);" onclick="openWeChat()">微信js</a>
55     </div>
56 </body>
57 </html>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM