I need to load a page, www.example2.com/page.html
, inside an iframe located at www.mysiteexample.com
.When the page is loaded I need to simulate a click inside the iframe, searching by element id.
Is it possible to bypass cross-site scripting?
This is my script, that doesn't work:
function onMyFrameLoad() {
$("#iframe").contents().find("#btn-to-push").click();
};
<iframe id='iframe' src="http://www.example2.com/page.html" onload="onMyFrameLoad(this)"></iframe>