【问题标题】:IE win.document.URL -> Access Denied ExceptionIE win.document.URL -> 拒绝访问异常
【发布时间】:2013-01-27 19:20:02
【问题描述】:

我的网站使用 OAUTH2.0 来允许用户使用他们的 gmail 帐户登录... 我使用以下代码显示 OAUTH 登录页面:

 var win = window.open(_url, "windowname1", 'width=800, height=600');

 var pollTimer = window.setInterval(function () {
     if (win.document.URL.indexOf(REDIRECT) != -1) {
         window.clearInterval(pollTimer);
         var url = win.document.URL;
         acToken = gup(url, 'access_token');
         tokenType = gup(url, 'token_type');
         expiresIn = gup(url, 'expires_in');
         win.close();

         validateToken(acToken);
     }
 }, 500);

不幸的是,这段代码在 IE 上引发了异常(在 Chrome 和 Firefox 中完美运行)。

谁能告诉我如何在 IE 中访问以前打开的窗口的当前 URL?

【问题讨论】:

  • 这两个窗口对象是否来自同一个域?
  • 在成功的 OAUTH 请求之后,它应该具有相同的域。

标签: javascript internet-explorer oauth-2.0


【解决方案1】:

Try/Catch 为我完成了这项工作,因此只要 OAUTH2.0 回调具有相同的域,IE 就会停止抛出异常...

【讨论】:

    猜你喜欢
    • 2015-05-26
    • 1970-01-01
    • 2012-05-19
    • 2011-04-02
    • 2014-11-19
    • 1970-01-01
    • 2013-05-24
    • 2014-09-25
    • 1970-01-01
    相关资源
    最近更新 更多