在JavaScript中访问iframe的Cookie

时间:2020-07-03 13:56:29

标签: javascript iframe cross-domain

我的网站托管在两个域中:

  1. foo.mydomain.com
  2. bar.mydomain.com

在foo.mydomain.com中,我想使用src =“ bar.mydomain.com”打开一个iframe,然后访问它的cookie。有可能吗?

最终目标是在iframe中成功登录后检索JSESSIONID cookie。

目前,我已经尝试过

iframe.onload = () => {
      var signInForm = iframe.contentWindow.document.getElementById("signInForm");
      console.log(signInForm)
    };

但是我遇到了 SecurityError:使用Firefox无法访问跨域对象上的属性“ document”

0 个答案:

没有答案
相关问题