alexduggan1

Export Godot to HTML5

Back

How to Export Godot to HTML5

I. Export the Project

  1. Go to the Godot Project you want to export.
  2. Make a build/web folder in the project.
  3. Go to Project -> Export.
  4. Press Add -> Web.
  5. Set the Export Path to be build/web/index.html.
  6. Paste the following line into Head Include:

<script src="coi-serviceworker.js"></script>

  1. Set the Canvas Resize Policy to Adaptive (this isn’t required for it to run, but it’s nice to have the canvas fill up the whole screen when it runs).
  2. Press Export Project.

II. Host the Project

  1. Copy the folder containing the project.godot (your project folder) and paste it into the repository that’s hosting it.
  2. Go to the repository, you will be working from there from here on out.
  3. Add coi-serviceworker.js and enable-threads.js in the build/web folder of the project.
  4. Push your changes.
  5. You should be done now. Go to where your project is hosted and try it out.

coi-serviceworker.js can be found at https://github.com/gzuidhof/coi-serviceworker/blob/master/coi-serviceworker.js

enable-threads.js can be found at https://github.com/josephrocca/clip-image-sorter/blob/main/enable-threads.js