Possible flaw in WebGL Facebook deployments

I’ve recently uploaded one of my WebGL games exported from Unity to Facebook using their Facebook web hosting service. However I have stumbled upon what seems to be quite a devastating potential flaw. Each time I upload a new version to Facebook it starts with fresh game data, the IndexedDB that Unity is using under the hood to store data in the browser basically is not shared across different versions of the game. Has anyone else noticed this? It makes using WebGL for Facebook quite useless because as soon as you put a version out you cannot update it, making your first version your last version.

I’ve got round this now by writing my own JavaScript plugin which saves the data to localStorage:

 var FileIO = {
	SaveToDB : function(data)
	{
		window.localStorage.setItem("gamedata", Pointer_stringify(data));
	},

	LoadFromDB : function()
	{
		var str = window.localStorage.getItem("gamedata");
		if (str === null || str === undefined)
			str = "";
		var len = lengthBytesUTF8(str);
		var buffer = _malloc(len + 1);
		writeStringToMemory(str, buffer);
		return buffer;
	}
 };
 
 mergeInto(LibraryManager.library, FileIO);

In my save data class I have:

    [DllImport("__Internal")]
    private static extern void SaveToDB(string data);

    [DllImport("__Internal")]
    private static extern string LoadFromDB();

    public void SaveGame()
    {
        BinaryFormatter bf = new BinaryFormatter();

        MemoryStream mem = new MemoryStream();
        bf.Serialize(mem, GameData);
        byte[] buffer = mem.ToArray();
        string sdata = Convert.ToBase64String(buffer);
        if (Application.platform == RuntimePlatform.WebGLPlayer)
        {
            SaveToDB(sdata);
        }
        else
        {
            PlayerPrefs.SetString("save", sdata);
        }
    }

    public void LoadGame()
    {
        string sdata;
        if (Application.platform == RuntimePlatform.WebGLPlayer)
        {
            sdata = LoadFromDB();
        }
        else
        {
            sdata = PlayerPrefs.GetString("save");
        }
        if (!string.IsNullOrEmpty(sdata))
        {
            BinaryFormatter bf = new BinaryFormatter();
            byte[] buffer = Convert.FromBase64String(sdata);
            MemoryStream mem = new MemoryStream();
            mem.Write(buffer, 0, buffer.Length);
            mem.Seek(0, SeekOrigin.Begin);
            _GameData = bf.Deserialize(mem) as GameData;
        }
        else
        {
            Debug.Log(">>>> Save File Not Found");
        }
    }

My data now seems to persist when I upload a new build to Facebook