HTML5 Use local assets


Is there a way to successfully run a HTML5 game locally? I mean, just double click “index.html” and have it load assets from the hard drive?

I know about appcache, but it seems to only work when trying to access a url without an internet connection right?

I have a client asking for a HTML5 game that is able to played both online and locally from a pendrive. I’m not sure this is possible without publishing to another platform, is it?



I usually do “nekotools server -p 2000 -h localhost -d .” inside the dir with the index.html and navigate there on the browser.

Or you could package with something like Electron.


Thanks for the answer, but this is not what i want - i’m looking for a way to run an html5 game with assets without the use of a web server. That means, the user should be able to simply double-click index.html to run the game without issues.

The use of a web server is the traditional way of doing it, i wanna know if there’s a way to do it without requiring it or if i should supply the web server with it (not ideal unless it can be supplied and run without any kind of installation).

By the way, is there a way to pack an OpenFL game with Electron? How would i go about it? Thanks!


Sure is. singmajesty details it in this post: Electron question
Works great.


Why not make a native binary?


Because the result is different (even if it shouldn’t), I suppose.


It has to run on web and mobile and must work even when offline - the final solution was to convince the client to at least access the url once and use appcache to download assets. Subsequent visits to the url will work even when offline in this way (and it works on both desktop and mobile browsers).