0

I am developing a HTML5 game, and would like to share it with file base. So my friends can play it with a local html file (file://xxx.html).

However, most of the storage are based on the domain, such as localStorage. I would like to know if there is any alternative to persist the game-progress-save under file-protocol?

I searched that windows.name may be the solution, but it can not store data after closing the browser. Javascript/HTML Storage Options Under File Protocol (file://)

I also found the FileSystem API (Window.requestFileSystem), but seems only Chrome has implemented it.

Any suggestion?

  • An alternative is to bundle your game's HTML file and other assets with a small static-file webserver. See here: https://stackoverflow.com/questions/5050851/best-lightweight-web-server-only-static-content-for-windows – Dai Mar 13 '20 at 08:01

1 Answers1

0

You can:

  • Bundle it by using Cordova or Electron
  • Use Node.js + lite-server
  • Use some free hosting service, my prefered solution would be Firebase as you would get a free yourGame.web.app domain, certificate and storage. You could set it up in less than an hour. To be honest, this is what I would do as it would be easiest for your friends to access the game too.
radulle
  • 1,437
  • 13
  • 19