<!doctype html> <html> <head> <meta charset="utf-8"> <title>login</title> <script src="//mat1.gtimg.com/app/openjs/openjs.js#debug=yes"></script> <script defer="defer"> /*jslint laxcomma:true*/ T.init({ appkey:801124054, callbackurl: ['http://open.t.qq.com/open-js/doc/snippet/code/callback.html?' // 通用方案html文件网址 ,'return_to=',encodeURIComponent('http://open.t.qq.com/open-js/doc/snippet/code/samewindow.html') // 你的应用网址 ,'&appkey=801124054' // 你的AppKey ].join(''), samewindow:true }); function login() { T.login(function (loginStatus) { alert(loginStatus.nick); },function (loginError) { alert(loginError.message); }); } T.ready(function () { var loginStatus = T.loginStatus(), template = T.template(); if (!loginStatus) { template.add('未登录'); } else { template.add('已登录'); } template.add('<br/>'); if (window != window.parent) { template.add("请点击新窗口按钮,在新打开的窗口预览效果。"); } else { template.add('<input type="button" value="登录授权" onclick="login();"/><input type="button" value="登出" onclick="T.logout();"/>'); } document.body.innerHTML = template.render(); }); </script> </head> <body> </body> </html>
openjs腾讯微博授权登录
猜你喜欢
转载自hylxinlang.iteye.com/blog/1900676
今日推荐
周排行