IndexedDB not working on HTML5 export

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By SamTT

I want to save my game data on IndexedDB as Godot allows. But I can’t see any kind of data and OS.is_userfs_persistent() return always false . I use google chrome as browser and cookies are activated.

func _ready():
	var dir = Directory.new()
	if !dir.dir_exists("user://Saves"):
		dir.open("user://")
		dir.make_dir("user://Saves")
	if OS.is_userfs_persistent():
		print("IndexedDB works")

It would be very helpful if somebody can help me to solve this problem.

You actually don’t write any data, you just create a directory. It might be that the userfs only stores actual files (with their path). Just guessing though.

Try to open and write a file.

I can write to user:// in HTML5 and I can see the data in the (Firefox) Inspector under Indexed DB → → /userfs → FILE_DATA → one key per file name. I didn’t check is_userfs_persistent though.

Here’s my app if you want to check if your browser is compatible with Godot and Indexed DB:

Narrowboat Simulator - Try it

Just change something in the game options and data should be written to Indexed DB.

wombatstampede | 2019-10-11 12:15