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
Implement some way to save files to real file system in a HTML5 version of a Godot game. #18947
Comments
I think this a browser limitation, it doesn't let JavaScript or WebAssembly mess with the host filesystem. |
CC @eska014 |
We can open a native file dialog. But if I add a function for that to |
@eska014 Here is already implemented for Window, Linux (GTK+), and macOS |
Also see this thread on the Godot subreddit in which I suggested @Ivoch to open an issue here. |
Can't we use local storage? That's still not accessing the filesystem in general, but it does save stuff to a place on the filesystem. |
Persistent The problem is, do we want to maintain functionality to open a native file dialog, e.g. |
Or at least, we could use interoperability so that HTML5-specific stuff that we can't put in Godot can be done with JS? |
You can already execute JavaScript in the browser using |
On Android it would mean not having to make |
What about an encrypted CSV with a dev-selected private key as an option to fill in the export settings? (mere guess, I mean, that's what I was planning for my own html5 projects, either we get such a functionality or not) |
Can JavaScript even force the browser to open a native file dialog? I don't remember seeing this, unless the browser is configured to ask for download location every time. We can however force a download using JavaScript, including from a Base64 data URI or similar. Just make sure not to initiate several downloads at once, or the browser will prompt the user before starting (Firefox does this at least). The file location is chosen by the browser, there's no way to override it. Maybe this can be implemented using the JavaScript singleton, in which case we could delegate this to a third-party asset. |
Feature and improvement proposals for the Godot Engine are now being discussed and reviewed in a dedicated Godot Improvement Proposals (GIP) (godotengine/godot-proposals) issue tracker. The GIP tracker has a detailed issue template designed so that proposals include all the relevant information to start a productive discussion and help the community assess the validity of the proposal for the engine. The main (godotengine/godot) tracker is now solely dedicated to bug reports and Pull Requests, enabling contributors to have a better focus on bug fixing work. Therefore, we are now closing all older feature proposals on the main issue tracker. If you are interested in this feature proposal, please open a new proposal on the GIP tracker following the given issue template (after checking that it doesn't exist already). Be sure to reference this closed issue if it includes any relevant discussion (which you are also encouraged to summarize in the new proposal). Thanks in advance! |
Godot version: 3
OS/device including version: HTML5
Issue description: There is currently no way to save/download files from within a HTML5 version of a Godot game.
Steps to reproduce: Create a small project with one Button and one FileDialog that saves an arbitrary text file. Works as expected in all exported versions, except HTML5. There is currently no way to save a file locally from HTML5, for example save games. FileDialog shows some virtual file system, probably in the browser sandbox mode. The file is only saved there and is inaccessible from the local OS or the server backend.
Minimal reproduction project:
htmlsave.zip
The text was updated successfully, but these errors were encountered: