You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to disable a button I've created for grabbing the user location when the user denies location services in their browser dialog after a call to get_geolocation(). How do I detect that that denial has occurred so I can disable the button going forward? I've tried using the below code but it always returns None for both the session state variable and the returned value from streamlit_js_eval (I've also tried making it a raw string in python to avoid concerns with things like the {} brackets but no luck). This throws no errors:
allowed=st_js(js_expressions="navigator.permissions.query({name:'geolocation'})", key="geolocation_permission")
st.write(f"Geolocation permitted: {allowed} and {ss.geolocation_permission}")
The text was updated successfully, but these errors were encountered:
So far as I can tell, that function executes asynchronously. So right now I have to wait some timeout period, checking if the value has changed from None to something else, even if the user has permitted location services. Unfortunately this means that I can't tell if a value of None means "user will not permit" or "timeout reached" (I use 10 seconds and that is sometimes not enough even when permission is granted - why does it seem so slow btw?)
I'm trying to disable a button I've created for grabbing the user location when the user denies location services in their browser dialog after a call to
get_geolocation()
. How do I detect that that denial has occurred so I can disable the button going forward? I've tried using the below code but it always returnsNone
for both the session state variable and the returned value fromstreamlit_js_eval
(I've also tried making it a raw string in python to avoid concerns with things like the{}
brackets but no luck). This throws no errors:The text was updated successfully, but these errors were encountered: