How to change my code, so that i behave different when played in web

Godot Version

4,3

Question

So i upload my game to itch, but i noticed i lacks when it’s saves so i want to disable saving and loading when it’s played in the browser.

Here is what i tried:

	if OS.get_name() != "WEB":  #THIS LINE 
(This i used before every safe and load func)

		if not FileAccess.file_exists(SETTINGS_FILE_PATH):
			config.set_value("video", "fullscreen" , true)
			
			
			config.set_value("audio", "music_volume", 1.0)
			config.set_value("audio", "sfx_volume", 1.0)

But i doesn’t seem to work. How to do this the right way? , it’s still lacking and it also does safe and load

And also, i’m surprised , that saving actually works. Can i really read and edit data on others PC with the web?

OS.get_name() works, but you are looking for "Web", not all-caps

1 Like