移动端,pc短添加好友、群功能

感谢博主: 

https://passport.csdn.net/?service=http://write.blog.csdn.net/postlist    (pc端的链接)      

https://passport.csdn.net/?service=http://write.blog.csdn.net/postlist    (移动端qq、qq群链接)

http://blog.csdn.net/u014798510/article/details/52209558                     (pc移动端检测)

提供的资料。



-----------------------------------------------------------------------------------------------分割线

2017.9.1更新


	function isMoveBrowser() {  
		var sUserAgent = navigator.userAgent.toLowerCase();  
		var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";  
		var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";  
		var bIsMidp = sUserAgent.match(/midp/i) == "midp";  
		var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";  
		var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";  
		var bIsAndroid = sUserAgent.match(/android/i) == "android";  
		var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";  
		var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";  
		document.writeln("您的浏览设备为:");  
		if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {  
			return true; 
		} else {  
			return false;
		}  
	}
	
	
	function chart(){
		str = "";
		if(!isMoveBrowser()){
			//pc
			str = "tencent://AddContact/?fromId=45&fromSubId=1&subcmd=all&uin=1234512&website=www.oicqzone.com";
		}else{
			//move
			str = "mqqwpa://im/chat?chat_type=wpa&uin=1234512&version=1&src_type=web&web_src=bjhuli.com";
		}
		window.location = str;
	}
蓝色为填写qq号码的地方,qq群替换成qq群的链接: "mqqapi://card/show_pslcardsrc_type=internal&version=1&uin= 18863883 &card_type=group&source=external"

你可能感兴趣的:(HTML5)