12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>测试用页面</title>
- <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
- <script src="http://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script>
- <style>
- div, a {
- font-size: 60px;
- }
- </style>
- </head>
- <body>
- <div>
- <a onclick="getMsgByWX()">获取微信数据</a>
- </div>
- <br>
- <div>
- <a onclick="getMsgByWB()">获取微博数据</a>
- </div>
- <script>
- function getMsgByWX() {
- }
- function getMsgByWB() {
- }
- (function() {
- if (!!navigator.userAgent.match(/AppleWebKit.*Mobile.*/)) {
- var ua = navigator.userAgent.toLowerCase() , url = "";
- // if (ua.match(/MicroMessenger/i) == "micromessenger") {
- alert("微信浏览器中打开");
- url = "https://open.weixin.qq.com/connect/oauth2/authorize?"
- +"appid=wx749c84daac654e1e&"
- +"redirect_uri=wx.ttkuaiban.com&"
- +"response_type=code&"
- +"scope=snsapi_base&"
- +"state=STATE#wechat_redirect";
- //https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx749c84daac654e1e&redirect_uri=wx.ttkuaiban.com&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect
- // }
- if (ua.match(/WeiBo/i) == "weibo") {
- alert("在新浪微博客户端打开");
- url = "https://api.weibo.cn/oauth2/authorize?"
- +"client_id=2141531565&"
- +"display=mobile&"
- +"response_type=code&"
- +"redirect_uri=code&"
- +"scope=snsapi_base";
- }
- //window.location.href = url;
- $.get(url ,function(data,status){
- console.log("Data: " + data + "nStatus: " + status);
- $.post("demo_ajax_gethint.html",{suggest:txt},function(result){
- $("span").html(result);
- });
- });
- }
- })()
- </script>
- </body>
- </html>
|