Though there are ways to store a single session’s states (like this), there currently seems to be no way to persist them across refreshes for a single user/client. (Something roughly like a browser cookie or local storage)
Not to be confused with a global persistent states (like this or this).
It would be great if we could use the device fingerprint
of the client to store a state object specific to that client.
Would that be possible?
1 Like
I’m currently testing fingerprintjs2 for device fingerprinting, we could put that in a Streamlit component to send back browser data to the Streamlit server and hack the state implementation a bit to store device fingerprints instead of session ID.
But given the security policy of the component’s IFrame I’m not sure this library will be able to collect all of the device information it needs to create a decent fingerprint (and I’m actually happy with this. From a user perspective, even if it’s for a small Streamlit app, there may need to be some form of acceptance from the user to be tracked by device. Being prevented from running arbitrary JS helps frame the question of user data collection better).
Best way is to try now
1 Like
Great! Thanks a lot.
Please do update here on how it goes after you try it out.
Yeah hopefully someone tries before me as I’ve got other things to do you can eventually try running the code snippet in components.html
and see what happens
1 Like
Would love to see a fingerprint/cookie solution as well