强制打开qq

(function(){
     var QQ='10001';  //换成你公司的企业QQ(客服QQ)
     var str='tencent://message/?Menu=yes&uin='+QQ+'&Site=jb51net&Service=300&sigT=45a1e5847943b64c6ff3990f8a9e644d2b31356cb0b4ac6b24663a3c8dd0f8aa12a595b1714f9d45';
     if(window.navigator.userAgent.indexOf('MSIE')!=-1){
           document.onclick=function(){
                var iF=document.createElement('iframe');
                iF.src=str;
                iF.frameBorder='0';
                iF.style.display='none';
                document.body.appendChild(iF);
           };
           var event = document.createEventObject();
           document.fireEvent('onclick',event);
     }else{
          var oA=document.createElement('a');
          oA.href=str;
          oA.style.display='none';
          document.body.appendChild(oA);
          var event = new MouseEvent('click');
          oA.dispatchEvent(event);
     }
})()

 

posted @ 2018-03-23 14:22  asimpleday  阅读(1300)  评论(0编辑  收藏  举报