関連する質問:更新なしの OAuth (Instagram)
状況
Instagram は、認証のために完全なリダイレクトを想定しており、その後リダイレクトされます。ポップアップで動作させたい。
考えられる解決策
ポップアップでページを開きます。
var authWindow = window.open(instagramUrl, 'authWindow');
次に、自分自身を閉じるページに instagram をリダイレクトします。
<script>window.close()</script>
問題
ウィンドウが閉じられたことを確認する方法がわかりません。次の両方が機能しません。
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);
代替提案は大歓迎です!