Are there any properties or events I can listen for from within the iframe
to determine this?
The iframe
src
and parent page are on different domains.
Are there any properties or events I can listen for from within the iframe
to determine this?
The iframe
src
and parent page are on different domains.
I know you don't have control over the parent page, but if you can convince the host to add some code, you may be able to do something like the following:
//OnParent Page
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script>
var bReady = false;
$(document).ready(function () {
bReady = true;
});
function isReady() {
return bReady;
}
</script>
//in iframe page
<script>
var bReady = false;
while (bReady == false) {
bReady = window.opener.isReady();
}
</script>
Only if you can modify the parent page as well. If you can't, it's XSS and there's no legitimate way to do it.
parent.html:
...
<body onload="theFrame.parentLoaded()">
...
<iframe src="http://other.domain.com/frame.html" name="theFrame"></iframe>
...
frame.html:*
...
<script type="text/javascript" language="javascript">
function parentLoaded(){
//code here will be executed when the parent page has finished loading
}
</script>
...