0

I'm trying to set up event, which should fire when iframe is loaded. It is important to acknowledge, that I want this event to fire INSIDE iframe, not in parent page. Actually, parent doesn't have to know that iframe was loaded.

On the beggining I've tried $(function() {....} (document.ready) event, but it doesn't seem to work as expected. It seems that it fires when parent page was loaded (the same event on parent page works as expexted).

Then, I've tried window.onLoad = function() {...} but it doesn't seem to work at all (event not fired).

So, how to do that? Again, I'd like the page inside iframe to know that loading was complete. Basically, I'd like to have event, that will work in iframe page as $(function() {}) in parent page.

Andrzej
  • 848
  • 1
  • 11
  • 26

2 Answers2

0

I am afraid you can't do this in a right way.

See this link : How to add onload event to a div element?

May be somebody should post the ticket to github.

Community
  • 1
  • 1
Usama Noman
  • 503
  • 1
  • 4
  • 10
0

If you own the page being loaded into the iframe, put the code in the page being shown in the iframe, not the parent page. If you do not own the page being loaded into the iframe, you cannot do what you're attempting due to cross-domain security sandbox restrictions. You would need a CORs solution http://en.wikipedia.org/wiki/Cross-origin_resource_sharing

Radio
  • 2,810
  • 1
  • 21
  • 43