gpt4 book ai didi

javascript - 如何自动插入我在 iframe 内的 内标记的单词

转载 作者:行者123 更新时间:2023-11-28 01:24:32 25 4
gpt4 key购买 nike

自动将我标记的单词插入到 iframe 中。

这是一个 chrome 插件

<html>
<iframe id="iframe" frameborder="0" src="http://www.maozakor.co.il/demo/default.aspx">
</iframe>

<img id="photo" src="https://i.imgur.com/q91Y1ly.png" style="max-width: 100%; min-height: 175px;">

<style>
body {
overflow:hidden;
}

#iframe {
position: absolute;
overflow:hidden;
height: 100%;
width: 100%;
top: -70px;
}

#photo {position: relative;
top: 80px;
left: 800px;
z-index: 21003005 ;
}
</style>
</html>

最佳答案

只要您有权在 iframe 内部和外部编辑代码,就可以实现这一点。您需要在 iframe 内部设置一个消息监听器,用于监听您发送的单词,并将其插入到文档中。

在这里查看 Window.postMessage()

https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage

我没有用 chrome-plugins 试过这个,但我可以确认它在常规网站中跨域工作。

关于javascript - 如何自动插入我在 iframe 内的 <text area> 内标记的单词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51317837/

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