权限被拒绝尝试在 IE 中关闭 window.open

发布于 12-27 23:25 字数 567 浏览 2 评论 0原文

我正在主窗口的弹出窗口中进行服务器端 Facebook 身份验证。它基本上是这样工作的:

  1. 单击 FB 登录按钮 使用 window.open 打开一个窗口
  2. 这个新窗口会连接到我的服务器,该服务器尝试在后端进行身份验证。
  3. 如果FB重定向,则弹出窗口中显示FB认证页面。此时,FB已掌控一切。
  4. 用户通过身份验证后,FB 将使用我提供的 url 重定向回我的服务器。
  5. 我的服务器使用一些 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:

  1. Click the FB login button Pop open a window using window.open
  2. This new window reaches out to my server which tries to authenticate on the back end.
  3. If FB redirects, the FB authentication page is displayed in the popup window. At this point, FB is in control.
  4. Once the user authenticates, FB redirects back to my server with my provided url.
  5. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文