gpt4 book ai didi

javascript - 读取 IFrame cookie

转载 作者:搜寻专家 更新时间:2023-11-01 05:06:01 24 4
gpt4 key购买 nike

我创建了一个 iframe 并在其中加载了一个网站(我无权访问该网站 - 它不是我写的)

<script type="text/javascript">

var el = document.createElement("iframe");
el.setAttribute('id', 'ifrm');
document.body.appendChild(el);
el.setAttribute('src', 'http://AWEBSITE.com/');
alert(document.getElement("iframe").cookie); //This doesnt work.....
</script>

我能否以某种方式使用 javascript 来读取 iframe 的 cookie?

最佳答案

这是不可能的,因为 same origin policy .您真的希望有人能够在任何页面上粘贴 iframe,指向任何域并获取您的 cookie 吗?

关于javascript - 读取 IFrame cookie,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15817957/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com