javascript - Click over an iFrame by clicking dynamically on certain coordinates -
i trying click on iframe, there button, clicking dynamically on coordinates. created button dinamically clicks on coordinates button located, not work.
in jsfiddle sample have button clicks on coordinate of x=30px , y=30px of document bing logo located, when click on button, bing logo in iframe not trigger.
<div class="button">click here</div> <iframe src="https://www.bing.com/images" width="200" height="70"></iframe> <script> function clicktransfer(x, y) { jquery(document.elementfrompoint(x, y)).click(); } $( ".gray" ).click(function() { clicktransfer(30, 30); }); </script>
any thoughts?
your script has accessed main document. document in iframe separate document own dom structure. may access this:
var doc = $('iframe')[0].contentwindow.document;
but cross-domain restriction. in other words, can not access document in iframe has different origin.
Comments
Post a Comment