提问人:Sted 提问时间:9/2/2022 最后编辑:Sted 更新时间:9/2/2022 访问量:257
使用 Javascript 获取和替换 iframe 中的字符串
Get and replace string inside the iframe using Javascript
问:
我想将字符串放在 iframe 中,从 到_top
_blank
例:
我的域名 :example.com
来自 iframe 域的数据:example.net
iframe 内的字符串
<a href="https://www.example.com" target="_top">foo</a><br />
<a href="https://www.example.net" target="_top">bar</a>
我的尝试:
const frame = document.querySelectorAll('a[target="_top"]').forEach(el => el.target = '_blank');
我的代码可以很好地替换 iframe 外部的字符串,但它不能替换 iframe 内部的字符串。
答: 暂无答案
评论
async