Question

Iframe preventing interaction of other parts of website - how to resolve?

I have a godot game in an HTML (same origin) iframe with a lot of assets exported to the web, which requires a lot of assets and thus has a large loading time. Currently what I am doing is hiding the iframe and showing a few survey questions to the user. While the user fills those questions out, the iframe is to load. Ideally, by the end of the survey, the app is already loaded and the user will feel a seamless experience.

However, this is not what is happening. The problem I am facing is that while the iframe loads while hidden, I cannot interact with other parts of the webpage(ex cannot click buttons or write text) until it is finished - rendering the whole idea useless.

I tried using web workers in the iframe source JS, however it seems like Godot cannot support this. I would have to work with the obfuscated godot code if I ever wanted a chance to fix this issue so that's not ideal.

What can I do to fix this?

 2  42  2
1 Jan 1970

Solution

 1

Iframes run in the same thread as the parent page, so if you have a slow script, it will slow down the parent page as well.

The best you are likely to be able to do, is to add as many setTimeout or requestAnimationFrame calls into you game start up code, to allow the parent page some breathing room to run it’s own code.

2024-07-20
David Bradshaw