我在我的網站上實施了外部OAuth身份驗證。 按鈕點擊我打開彈出與我們的Facebook的授權頁面。 現在我需要知道何時完成認證以讀取OAuth令牌並關閉彈出窗口。當打開的彈出窗口的位置發生變化時收到通知
click: function() {
var popup = window.open(url, title, '<options>');
popup.onload = function() {
//1. if url contains token - finish OAuth authentication
//2. close popup
//but 'onload' doesn't work for external domains
}
return false;
},
當我嘗試使用輪詢技術,我hetting以下安全錯誤訪問:
Uncaught SecurityError: Blocked a frame with origin " https://some_app_host_not_the_same_as_following.com " from accessing a frame with origin " https://some_auth_host_which_works_with_facebook.com ". Protocols, domains, and ports must match.
我怎樣才能做到這一點?
可能重複(http://stackoverflow.com/questions/3291712/is-it-possible-to- open-a-popup-javascript-and-then-detect-when-the-user-clo) – rfornal 2014-12-06 02:33:44