Embedding Defold Game In Existing HTML Page

Hi everyone,

I am working on a game in Defold that I would like to publish to HTML5, but I have an existing webpage where the game needs to be embedded. Is it possible to embed a Defold game in an existing webpage, and would I be able to embed the game within it’s own individual panel that fits within the rest of the page’s structure and behaves like a typical HTML element?

Thank you!

1 Like

Sure, that is possible. If you make a Defold HTML5 bundle you can inspect the code in the generated index.html. There is a <div> for the canvas and a <script> tag which loads the engine etc. You should be able to lift all of that into your own webpage.

Another option is to do what poki.com, itch.io and others are doing and load the index.html of your Defold game in an <iframe>.

3 Likes

That is great to hear! Thank you very much. So I would open the auto-generated index.html page, extract the code that contains and loads the game using a web browser’s inspect capabilities, and integrate that code into my own webpage? That is extremely simple!

1 Like