如何自动插入我在 iframe 内的<文本区域>内标记的单词



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

这是一个铬插件

<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插件,但我可以确认它在常规网站中跨域工作。

最新更新