javascript - 如何从新窗口运行 javascript 到现有窗口
问题描述
const winHtml = `<button id="cool">Run code on other window</button>`;
const winUrl = URL.createObjectURL(
new Blob([winHtml], { type: "text/html" })
);
const win = window.open(
winUrl,
"win",
`width=800,height=400,screenX=200,screenY=200`
);
所以我希望能够从一个用 JS 打开的新窗口运行代码。这不是一个新的浏览器选项卡,它是一个插入了 html 的新浏览器窗口。是否可以将代码从它运行到现有的浏览器窗口?
解决方案
推荐阅读
- javascript - 如何在单击功能下捕获多个按钮并将内容发送到本地存储
- java - 有没有办法扩展 fxml 控制器
- django - 我遇到了一个错误,说“未找到“登录”的反向。'login' 不是有效的视图函数或模式名称。'
- unity3d - 统一的 SVG 不透明度
- python - “ModuleNotFoundError:没有模块命名
- angular - 如何以角度的静态方法注入平台ID
- javascript - JavaScript 文件未在 Flask 网页中加载
- azure - Azure 如何通过 VNET 内的私有 IP 调用 Azure Private Endpoint(Azure Private Link 服务)
- ios - Swift 5:AVPlayer 将多个音频文件叠加在一起
- python-3.x - Tornado websocket 服务器和 websocket 客户端同时在一个循环中与 AsyncIO