Can I listen to any cross-domain iframe events?

Are there any events that I can listen in iframes in another domain? For example, enter this page in domain 1:

<html>
<body>
  <iframe src="domain2.com"></iframe>
</body>
</html>

What events can I listen to regarding the contents of an iframe?

Thank!

+3
source share
2 answers

There are several ways to do this. In new browsers, you can use window.postMessage to communicate between domains between windows (also works for iframes):

https://developer.mozilla.org/en/DOM/window.postMessage

URL- iframe . iframe , : http://ajaxian.com/archives/cross-domain-iframe-communication-without-location-polling

0

, ( iframe IE), , , ... , , .

0

Source: https://habr.com/ru/post/1751095/


All Articles