Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

downloading website to work offline without a web server? #7

Open
Android986player opened this issue Nov 6, 2024 · 3 comments
Open

Comments

@Android986player
Copy link

how can I download the web version to an HTML file?
I want it to be able to save, load, and load the game data

@GMH-Code
Copy link
Owner

GMH-Code commented Nov 6, 2024

Good question!

The game will just run from the buildable collection of static HTML/JavaScript/WebAssembly files -- but it needs a proper web server to host those files. You can't run the project from file:// links, because modern browsers prevent downloading (at least) from those kind of links.

This restriction isn't the fault of the Quake2-WASM project, but rather to do with your browser's security and the lack of headers. Emscripten needs to download multiple JavaScript/WebAssembly files, and your browser won't do this without seeing the proper headers from a web server. Without it, CORS restrictions, and other problems, like unknown MIME types (which are provided by a proper web server), will prevent certain actions on file:// links.

As far as I know, there is no way of bypassing file:// restrictions, and I really wouldn't recommend it anyway -- maybe if the WASM was integrated inside the JavaScript, it'd get further. This is possible, but again not recommended for various reasons, and it probably wouldn't run entirely anyway.

You'll need to either run a mini web server executable, or any other proper web server!

@Android986player
Copy link
Author

I'm on chrome os though...

@GMH-Code
Copy link
Owner

GMH-Code commented Nov 6, 2024

Yeah, in that case the restrictions will apply just the same.

There is a way, I think -- on Android mobile devices, without root, you can run a 'localhost' web server as a service on a high numbered port, which you can then connect to from a browser with an address like http://127.0.0.1:8000/quake2.html, or similar. You should be able to do the same thing on Chrome OS, with the right app!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants