我试图在iframe元素中注入脚本试图以这种方式实现,子和父不属于同一个域(我知道XSS在最新浏览器中被阻止)有没有办法将脚本注入按钮的子元素点击父母元件.(在Chrome控制台中有类似的运行脚本)
var myIframe = document.getElementById("myIframeId");
var script = myIframe.contentWindow.document.createElement("script");
script.type = "text/javascript";
script.src = "randomshit.js";
myIframe.contentWindow.document.body.appendChild(script);
Run Code Online (Sandbox Code Playgroud)