Access Parent Window From Iframe (cross-domain)


Answer :

If I were you I would check out window.postMessage. It may do what you want:

For reference see the following:

  • MDN - Window.postMessage
  • https://stackoverflow.com/a/3076648/296889 - see the Window.postMessage section

If I understand correctly, all modern browsers do now allow to do this. So I'm here to find the best solution.

This is your solution. What you're asking is not possible.

See related questions:

EDIT

As mentioned in the comments below, @JeremysAwesome's answer offers a method that would allow cross-domain requests under certain circumstances. See the SO question below for more information.

Ways to circumvent the same-origin policy


but you can change the src attribute of the iframe (adding a #hashtag for example) and listen to the onhashchange event in the child window. Given that you're in position to change both pages.


Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable