Determine when webpage has woken up from a containing HTML document

I have embedded a glitch project in an iframe in another page. Is there a way the containing document can sense when the glitch page has loaded?

Use the onload attribute to run javascript once iframe has fully loaded.

Like:

<iframe src="https://glitch.com" 
onload="runSomeFunction()"
>
</iframe>

will show Glitch.com but when it loads, it will run that function.

1 Like

I think they meant detecting when the ‘Waking Up’ cycle is over. @proGuest_0 You could set an interval (e.g. Every one second) that checks the innerHTML of the iframe for the words ‘Waking Up’ and if they are not present it can start a new function or do something like change its style properties.

1 Like

Example @proGuest_0
This may or may not work, I don’t have time to check
EDIT: This does not work due to cross-orgin security

<iframe src="/whatever/glitch/gives/you" id="myglitchiframe" style="display:none;">
<script>
setInterval(function(){
if(!document.getElementById("myglitchiframe").contentWindow.document.body.innerHTML.includes("Waking up")){
document.getElementById("myglitchiframe").style.display = "block";
} 
}, 3000);
</script>
1 Like

You should probably fire it at every millisecond. No harm, really. But if you add the words, “Waking Up” it will stay hidden.

1 Like

Good idea. Too bad it doesn’t work. Is there a way to set the glitch embedded page to allow this cross orgin security breach?