Insert script inside iframe of another domain

I tried to enter a script inside an iframe trying to implement this method, child and parent do not belong to the same domain (I know that XSS is prevented in recent browsers) is there any way to insert a script to the child of the click button on the parent element. (similar startup scripts in the chrome console)

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);
+5
source share
1 answer

Nope. The same origin policy dates back to Netscape 2.0.

If you cannot crack / xss other site files to embed JS, it will be difficult for you.

, , , , window.postMessage, JSONP Ajax CORS ( 2 ). , .

+5

All Articles