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

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

WBOY
풀어 주다: 2016-06-07 11:42:39
원래의
4273명이 탐색했습니다.

可调用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元

원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 추천
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿