views:

274

answers:

1

I have a question similar to that posed in the "Detect failure to load contents of an iframe" issue. I am putting together a web page that loads a Google calendar as an iframe. I know that a large number of the computers that will use my web page will have restricted internet access such that the Google calendar won't load into the iframe. I would like to put a "timer" into my page that stops trying to load the Google calendar after a set amount of time or attempts and instead loads a local page that says the calendar can't be accessed.

I have been trying to use the checkForContents() function described previously, but I have now realized that I can't get any of the object properties from the Google site. In other words, document.getElementById(iframe).contentWindow.document returns nothing (or at least nothing useful) and the function fails silently but totally. I can instead use document.getElementById(iframe).contentWindow which simply returns "[object Window]" (and I don't seem to be smart enough to do anything useful with that).

Any thoughts? Thanks.

+1  A: 

reasons of security sandbox, you can not reach or modify any content if the domains are different

Tolgahan Albayrak
I understand the issue of different domains. I'm looking for some way to solve the fundamental problem of testing that the frame hasn't loaded.
well use innerHTML to load a iframe :div.innerHTML = "<iframe src="stackoverflow.com" onload="myLoadFunc()" onerror="myLoadErrorFunc()" />"maybe this helps
Tolgahan Albayrak
Thanks. I'll give it a shot. But not today - other things are more pressing.