javascript - 试图访问某些网站的 HTML 并将其传输到弹出 IFRAME - 但无法获取它
问题描述
我正在尝试通过 iframe 和 google chrome 扩展获取网站的 HTML 文档,该扩展将 JS 注入到我能够弹出窗口的网站,但我无法获取“父”文档 - 只有孩子。这是我注入网站的代码:
let msg = window.document;
let child_url = "https://localhost:3000"
function sendData(){
let ref=window.open(child_url,"pop","width=450,height=650,resizable=1");
ref.postMessage('here i want to send the html document', 'https://www.ikea.co.il');
}
sendData();
这是我的 index.html 中的事件监听器(这是一个 vue 应用程序)
<script>
window.addEventListener("message", function(e) {
console.log(e);
});
</script>
不知何故,控制台只记录了我添加的代理服务器的孩子的 html 文档,它们都是 HTTPS 协议
解决方案
推荐阅读
- excel - 如何匹配excel中的行并附加列以添加数据
- amazon-web-services - 子域映射到 AWS 服务器
- android - Android:添加 Facebook SDK 时出现“INSTALL_FAILED_CONFLICTING_PROVIDER”错误
- c++ - c++ 连接网络(ubuntu),如何处理密码错误的情况
- javascript - 解析错误:类型转换表达式应包含在括号中
- spring-boot - 发生错误时如何停止消费来自kafka的消息并在春季启动一段时间后重新开始消费
- web - 如何向每个用户显示存储使用情况
- python - 使用装饰器对烧瓶应用程序进行身份验证
- python - 如何提取更大数据集的子集
- javascript - 移动图像上的 Onclick 事件不起作用