gpt4 book ai didi

javascript - Safari 和 Chrome 中的 iframe 问题

转载 作者:行者123 更新时间:2023-11-28 10:26:51 25 4
gpt4 key购买 nike

我的域 A 使用域 B 打开 IFRAME,域 B 打开使用域 A 的 IFRAME 以访问parent.parent。

我能够从 A 执行 JS 功能,除了 SAFARI 和 Chrome。

我有 Iframe DOM 元素,并且我做了 iframe.contentWindow.location 但它没有给我正确的域! (给我域名 B)

我能做什么?谢谢

最佳答案

那只是因为您从域 B 为 iframe 执行 contentWindow。要获得 A,您应该执行类似 document.getElemenetsByTagName('iframe')[0].contentDocument.getElemenetsByTagName('iframe')[0] 的操作。 contentWindow.location (请注意,我没有测试它)

关于javascript - Safari 和 Chrome 中的 iframe 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4091083/

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