AJc*_*dez 1 javascript instagram
相关问题:OAuth(Instagram)没有刷新
Instagram期望完全重定向验证,然后他们将重定向回来.我希望它能用弹出窗口.
在弹出窗口中打开页面:
var authWindow = window.open(instagramUrl, 'authWindow');
Run Code Online (Sandbox Code Playgroud)
然后我将instagram重定向到一个关闭的页面:
<script>window.close()</script>
Run Code Online (Sandbox Code Playgroud)
我无法弄清楚如何找出窗户关闭的时间.以下两者都不起作用:
authWindow.onbeforeunload = function() {
window.opener.console.log('Closing popup!');
};
function logClose(cnsl) { cnsl.log('Closing popup!'); }
var callback = _.bind(logClose, window, console);
$(authWindow.document).click(callback);
Run Code Online (Sandbox Code Playgroud)
我们非常欢迎其他建议!
<script>window.close()</script>
您可以使用window.opener
然后关闭窗口调用父窗口中的函数,而不是直接使用:
家长:
function onInstagramAuth()
{
// Handle however you would like here
console.log('authenticated');
}
Run Code Online (Sandbox Code Playgroud)
儿童:
try { window.opener.onInstagramAuth(); } catch (err) {}
window.close();
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2624 次 |
最近记录: |