1

I load a script (which is on a Domain B) inside a page that is in a Domain A:

<div id="page-of-domain-a">
    <script type='text/javascript' src='http://MyDomainB/init.js'></script>
    <div class='element-inside-page-a'></div>
</div>

this script preprend an iframe (hidden) into this page on Domain A (well, this will preload all elements/image/scripts of that page in Domain B).

At some point, using an handler declared inside the init.js:

$(document).on("click", ".element-inside-page-a", function (e) {
    e.preventDefault();
    SomeFunctionInsideIFrame();
});

I'd like to trigger an action inside the iframe (such as, "hey iframe, let now visible").

Since the script and iframe are on the same domain, why I got blocked by the same origin policy?

How can I trigger an asynch event within the iframe from the Domain A? (I have full access of the Domain B). Domain B proxy? Any suggestions?

markzzz
  • 47,390
  • 120
  • 299
  • 507

0 Answers0