Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
-1
rated 0 times [  5] [ 6]  / answers: 1 / hits: 37204  / 14 Years ago, sun, may 2, 2010, 12:00:00

I have a rather interesting problem. I have a parent page that will create a modal jquery dialog with an iframe contained within the dialog. The iframe will be populated with content from a 3rd party domain. My issue is that I need to create some dialog level javascript that can detect if the content of the iframe loaded successfully and if it hasn't within a 5 second time frame, then to close the dialog and return the user to the parent page.



I have researched numerous solutions and only two are of any true value.




  1. Get the remote site to include a javascript line of document.domain = 'our-domain.com'.

  2. Use a URL Fragment hack, but again I would need the request that the remote site
    able to modify the URL by appending '#some_value' to the end of the URL and my dialog window would have to poll the URL until it either sees it or times out.



Are these honestly the only options I have to work with? Is there not a simpler way to just detect this?



I have been researching if there's a way to poll for http response errors, but this still remains confined to the same restrictions.



Any help would be immensely appreciated.



Thanks


More From » iframe

 Answers
7

The easiest way (if you can get code added to the external sites) is to have them add an invisible iframe pointing to a special html file on your domain. This could then use parent.parent.foo() to notify the original window about the load event.



Listening for the load event will only tell you if the window loaded, not what was loaded or if the document is ready for interaction.


[#96906] Wednesday, April 28, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
michelecarissab

Total Points: 730
Total Questions: 97
Total Answers: 110

Location: Uzbekistan
Member since Sat, Feb 27, 2021
3 Years ago
;