Heim > php教程 > php手册 > 通过手机浏览器调用客户端QQ

通过手机浏览器调用客户端QQ

WBOY
Freigeben: 2016-06-07 11:42:39
Original
4277 Leute haben es durchsucht

可调用ios android QQ客户端,指定聊天QQ号,js代码
function qqcao(){<br>             var type = undefined;<br>             var param = "";<br>             var sid = 2;<br>             var rawuin = ;<br>             var qsig = "undefined";<br>             var QQApi = {<br>                 openURL: function(url){<br>                     var i = document.createElement('iframe');<br>                     i.style.display = 'none';<br>                     i.onload = function() { i.parentNode.removeChild(i); };<br>                     i.src = url;<br>                     document.body.appendChild(i);<br>                <br>                     var returnValue = QQApi.__RETURN_VALUE;<br>                     QQApi.__RETURN_VALUE = undefined;<br>                     return returnValue;<br>                 },<br> <br>                 isAppInstalled: function(scheme) {<br>                     var parameters = {'scheme':scheme};<br>                     var r = QQApi.openURL('jsbridge://app/isInstalled_?p=' + encodeURIComponent(JSON.stringify(parameters)));<br>                     return r ? r.result : null;<br>                 },<br> <br>                 isQQWebView: function(){<br>                     return QQApi.isAppInstalled('mqq') == true;<br>                 },<br> <br>                 __RETURN_VALUE: undefined<br>             };<br> <br>             var usa=navigator.userAgent;<br>             var p;<br>             var mobile_q_jump = {<br>                 android:"https://play.google.com/store/apps/details?id=com.tencent.mobileqq",<br>                 ios:"itms-apps://itunes.apple.com/cn/app/qq-2011/id444934666?mt=8",<br>                 winphone:"http://www.windowsphone.com/zh-cn/store/app/qq/b45f0a5f-13d8-422b-9be5-c750af531762",<br>                 pc:"http://mobile.qq.com/index.html"<br>             };<br>             var isMQ = 0;<br>             if(typeof type == "undefined") type = 1;<br>             if(usa.indexOf("Android")>-1){<br>                 p = "android";<br>             }<br>             else if(usa.indexOf("iPhone")>-1 || usa.indexOf("iPad")>-1 || usa.indexOf("iPod")>-1){<br>                 p = "ios";<br>             }<br>             else if(usa.indexOf("Windows Phone") > -1 || usa.indexOf("WPDesktop") > -1){<br>                 p = "winphone";<br>             }<br>             else {<br>                 p = "pc";<br>             }<br>             if(p == "ios"){<br>                 //防止循环<br>                 if(history.pushState)<br>                     history.pushState({},"t","#");<br>                 isMQ = QQApi.isQQWebView();<br>                 if (!isMQ){ <br>                     var sc = document.createElement("script");<br>                     sc.src = "http://__.qq.com/api/qqapi.js";<br>                     sc.onload = function(){<br>                         if(window['iOSQQApi']){<br>                             isMQ =iOSQQApi.device.isMobileQQ(); <br>                         }<br>                     };<br>                     document.body.appendChild(sc);<br>                 }<br>             }<br>             else if(p == "pc" && qsig != "undefined"){<br>                 window.open(qsig,"_self");<br>             }<br>             if(type == 1){//手Q<br>                 var isSuccess = true;<br>                 var f = document.createElement("iframe");<br>                 f.style.display = "none";<br>                 document.body.appendChild(f);<br>                 f.onload = function(){<br>                     isSuccess = false;<br>                 };<br>                 if(p == "ios" && sid == 1){<br>                     f.src = "mqqapi://card/show_pslcard?src_type=internal&version=1&uin="+ rawuin +"&card_type=person&source=qrcode";<br>                 }<br>                 if(p == "ios" && sid == 2){//ios并且为群名片<br>                     f.src = "mqqapi://card/show_pslcard?src_type=internal&version=1&uin="+ rawuin +"&card_type=person&source=qrcode";<br>                 }<br>                 else if(p != "pc"){<br>                     var url = window.location.href.split("&");<br>                     f.src = "mqqopensdkapi://bizAgent/qm/qr?url=" + encodeURIComponent(url[0]);<br>                 }<br>                 if(p == "android" && sid == 1){<br>                     f.src = "mqqapi://card/show_pslcard?src_type=internal&version=1&uin="+ rawuin +"&card_type=person&source=qrcode";<br>                 }<br>                 if(p == "android" && sid == 2){//ios并且为群名片<br>                     f.src = "mqqapi://card/show_pslcard?src_type=internal&version=1&uin="+ rawuin +"&card_type=person&source=qrcode";<br>                 }<br>                 var now = Date.now();<br>                 setTimeout( function(){<br>                     if((p == "ios" && !isMQ && Date.now() - now                          var jumpUrl = mobile_q_jump[p]; <br>                         if(jumpUrl) window.open(jumpUrl,"_self");<br>                     }<br>                 } , 1500);<br>                 <br>             }<br>         }

AD:真正免费,域名+虚机+企业邮箱=0元

Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Empfehlungen
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage