图集1/1

正文 3645字数 722,147阅读

<!--客服--> <style> .zixun1{width:83px; height:85px; position:fixed; right:5px; bottom:10px;} .zixun2{width:42px; height:42px; position:fixed; right:5px; bottom:10px;} </style> <div class="zixun1" style=" z-index: 999;"><img src="http://mresonancecomcn.test.resonance.net.cn//GZphp/Tpl/Home/Default/Public/images/zixun1.png" width="83" height="85" usemap="#Map" border="0"> <map name="Map" id="Map"> <area shape="rect" coords="62,0,83,18" href="javascript:;" onclick="ssqqbxx();"> <area shape="circle" coords="42,43,34" id="aaa1" target="_blank" href="javascript:;"> </map> </div> <div class="zixun2" style="margin-right:-44px;z-index: 999;"><a id="aaa2" target="_blank" href="javascript:;"><img src="http://mresonancecomcn.test.resonance.net.cn/GZphp/Tpl/Home/Default/Public/images/zixun2.png" width="42" height="42"></a></div> <script> $(function(){ var ua = navigator.userAgent.toLowerCase(); var isWeixin = ua.indexOf('micromessenger') != -1; var isAndroid = ua.indexOf('android') != -1; var isIos = (ua.indexOf('iphone') != -1) || (ua.indexOf('ipad') != -1); if (isWeixin) { //alert('微信来源'); //location.href = var newurl='http://wpa.qq.com/msgrd?v=3&uin={$qq}&site=http://www.resonance.com.cn/&menu=yes'; }else{ //alert('非微信来源'); //location.href = 'http://wpa.qq.com/msgrd?v=3&uin='+qq+'&site=http://www.resonance.com.cn/&menu=yes'; } if (isAndroid) { //alert('安卓来源'); var newurl='http://wpa.qq.com/msgrd?v=3&uin={$qq}&site=http://www.resonance.com.cn/&menu=yes'; }else{ //alert('非安卓来源'); //location.href = 'http://wpa.qq.com/msgrd?v=3&uin='+qq+'&site=http://www.resonance.com.cn/&menu=yes'; } if (isIos) { //alert('IOS来源'); var newurl='mqq://im/chat?chat_type=wpa&uin={$qq}&version=1&src_type=web'; }else{ //alert('非IOS来源'); //location.href = 'http://wpa.qq.com/msgrd?v=3&uin='+qq+'&site=http://www.resonance.com.cn/&menu=yes'; var newurl='http://wpa.qq.com/msgrd?v=3&uin={$qq}&site=http://www.resonance.com.cn/&menu=yes'; } $("#aaa1").attr("href",newurl); $("#aaa2").attr("href",newurl); }); function ssqqbxx(){ $(".zixun1").animate({marginRight:'-85px'},'slow',sssdfsdfll); //alert('fdasfdfdsf'); } function sssdfsdfll(){ $(".zixun2").animate({marginRight:'0px'}); } </script> <!--结束-->
Run code
Cut to clipboard


    在浏览器中可以通过JS代码打开QQ并弹出聊天界面,一般作为客服QQ使用。而在移动端腾讯貌似没有公布提供类似API,但是却可以使用schema模式来启动手机QQ。
    以下为具体代码:
    Android:
    String url="mqqwpa://im/chat?chat_type=wpa&uin=123456"; startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
    Run code
    Cut to clipboard


      iOS:
      UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero]; NSURL *url = [NSURL URLWithString:@"mqq://im/chat?chat_type=wpa&uin=123456&version=1&src_type=web"]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; webView.delegate = self; [webView loadRequest:request]; [self.view addSubview:webView];
      Run code
      Cut to clipboard


        浏览器:
        <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=123456&site=qq&menu=yes">click here</a>
        Run code
        Cut to clipboard