How to Play a Godot HTML Project Locally?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By AliAdel

Is there is a way to play a godot project without having to upload it to a server like itch.io by just opening it on a browser?

[ deleted ]

ccpixel | 2022-01-17 13:39

:bust_in_silhouette: Reply From: Wakatta

Yes

Open your browser then
File > Open > godot_export.html

Or

Double click and choose the app you want to use

:bust_in_silhouette: Reply From: andresTapa

Hi! There are two ways, one you can run it with the button to run it on browser that appear after you install the pakage to export to html. The other way you will have to install xampp, copy your exported files to the xampp’s docs folders (i dont remember exacly where but if you look for local web Page with xampp you should find tons of tutorials.). So
then with the exported files copyed you open xamps then hit play (in xampp) and it will open the browser with your game.

I prefer runing from godot in the browser directly with the html5 button.

:bust_in_silhouette: Reply From: ccpixel

I think this is a problem with modern browsers and fetching local files. My solution to this is to export it to html5, make sure to name it index.html when you save the export. Then you need to run a local server instead of just clicking the html file. I just open a terminal, navigate to the folder with the exported project and run python3 -m http.server.

Then you should be able to play it on localhost.

EDIT: As andresTapa said, there is an html5 button that appears in the top right of the Godot editor after you export it, which runs a server for you.