在瀏覽器中可以經過JS代碼打開QQ並彈出聊天界面。通常做爲客服QQ使用。html
而在移動端騰訊貌似沒有發佈提供類似API,但是卻可以使用schema模式來啓動手機QQ。java
下面爲詳細代碼:web
Android:瀏覽器
String url="mqqwpa://im/chat?chat_type=wpa&uin=123456"; startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
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];
<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=123456&site=qq&menu=yes">click here</a>
打開指定用戶的微博頁面:post
if (com.sina.weibo.sdk.ApiUtils.validateWeiboSign(context, "com.sina.weibo")) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("sinaweibo://userinfo?uid=" + weiboId)); Intent chooseIntent = Intent.createChooser(intent, "Weibo"); context.startActivity(chooseIntent); } else { NavigateHelper.startWebview(context, "http://weibo.com/u/" + weiboId); }