PC-side Page Call QQ Chat-Code Stripping and Including Chapters

Keywords: Web Development Mobile Javascript JQuery Android

Today, I received a message from the website saying that because of compatibility problems, he provided a new way to call QQ code.
Here Sue checked the source code of others and studied it. Peel off and paste it out for your reference and study.

Personal test from user tyj1021: wpa. This method can be used to call QQ on both computer and mobile phone at the same time. Only when safair browser opens, it jumps into App Store and other mobile browsers can also directly transfer to mobile phone Q.

The corresponding html code is as follows:

<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title></title>
</head>
<body>
	<p>Disclaimer: This case code only serves as code learning, and all disputes caused by commercial use have nothing to do with the blogger.</p>
	<br />	
	<h3><a href="javascript:chatQQ('123456');">immediately QQ Consultation</a></h3>

<script src="jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	$(window).on('load resize', function(event) {
        $(".buttonpush").click(function(event) {
            $(".neirong").addClass('neirong-show');
        });
        $(".neirong-close").click(function(event) {
           $(".neirong").removeClass('neirong-show');
        });

		if($('.slider').length > 0 && getClientInfo()!='PC'){
			$('.pfocus img').css({'position':'absolute'});
			if($(window).width() <= 768){
				$('.slider,.slider .item').css('height','375px');
			}else{
				var xx_height = $('.pfocus img').height();
				$('.slider,.slider .item').css('height',xx_height+'px');
			}
		}
    });
    
function getClientInfo(){  
   var userAgentInfo = navigator.userAgent;  
   var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");  
   var agentinfo = null;  
   for (var i = 0; i < Agents.length; i++) {  
       if (userAgentInfo.indexOf(Agents[i]) > 0) { agentinfo = userAgentInfo; break; }  
   }  
   if(agentinfo){
        return agentinfo;
   }else{
        return "PC"; 
   }     
}

function chatQQ(number){
	if(getClientInfo()=='PC'){
		window.open('http://wpa.qq.com/msgrd?v=3&uin='+number+'&site=qq&menu=yes','_blank');
	}else{
		window.location.href = "mqqwpa://im/chat?chat_type=wpa&uin="+number+"&version=1&src_type=web&web_src=guangfan.com";    
	}
}
</script>
</body>
</html>

For QQ source code calls in this case, please refer to Recommended website.

Disclaimer:

  1. This case code is only for code learning, and all disputes caused by commercial use are not related to the blogger.
  2. In case of infringement, please provide the claim information and contact the blogger to deal with the matter.

Design sketch:

Above is all about "PC-side page calls QQ chat - Code stripping and inclusion chapters".

Posted by mark123$ on Wed, 23 Jan 2019 23:00:14 -0800