权限被拒绝尝试在 IE 中关闭 window.open
我正在主窗口的弹出窗口中进行服务器端 Facebook 身份验证。它基本上是这样工作的:
- 单击 FB 登录按钮 使用 window.open 打开一个窗口
- 这个新窗口会连接到我的服务器,该服务器尝试在后端进行身份验证。
- 如果FB重定向,则弹出窗口中显示FB认证页面。此时,FB已掌控一切。
- 用户通过身份验证后,FB 将使用我提供的 url 重定向回我的服务器。
我的服务器使用一些 JavaScript 进行响应,如下所示:
opener.window.location = '/nextPage.html';
self.close();
在所有浏览器中,这都非常有效......除了 IE(并且,毫不奇怪,它有时也可以在 IE 中工作)。在 IE 中,我在调用 opener.window.location 时收到一条错误消息,显示“权限被拒绝”。
我意识到 IE 认为这是跨域的,因为窗口一秒就转到了 facebook,但试图关闭窗口的页面与父级来自同一域。我怎样才能让这样的东西在 IE 中工作?
谢谢!
I am doing server-side facebook authentication in a popup from my main window. It basically works like this:
- Click the FB login button Pop open a window using window.open
- This new window reaches out to my server which tries to authenticate on the back end.
- If FB redirects, the FB authentication page is displayed in the popup window. At this point, FB is in control.
- Once the user authenticates, FB redirects back to my server with my provided url.
My server responds with some JavaScript, as follows:
opener.window.location = '/nextPage.html';
self.close();
In all browser this works great... except for IE (and, not surprisingly, it also works in IE some of the time). In IE I get an error that says "Permission Denied" on the call to opener.window.location.
I realize that IE thinks that this is cross-domain since the window went to facebook for a hot second, but the page that's trying to close the window is from the same domain as the parent. How would I get something like this to work in IE?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论