Hi , I’ve developed an application which contain a login form (Authentication and Authorization ). This application is used to handles secure data in my organization.
As per the organization policies - I need to detect idle time situation and run logout.
I plan on a count-down timer that will do a logout when the idle time had passed.
To make this work, I need to be able capture any mouse event on the screen (to reset the count-down timer).
Any idea how to capture such event (can I add js::AddEventListener to solve this )
Sadly is seems that st.html can not run the java script.
And st.components.v1.html runs in an isolated iframe so we cannot get the response (i.e. mouse moved).
The only option I see is to build a new streamlit custom component that can capture and report events
Oh yeah, you are right. The thing with custom components is that they also run in their own iframes, so it sounds like you would run into the same limitation as with st.components.v1.html, right? Btw. here is a GitHub issue about the possibility to run components outside of an iFrame you could upvote: Inject Streamlit Components Directly into html instead of iFrame · Issue #2262 · streamlit/streamlit · GitHub (even though it does not help right in this moment).
The only alternatives I can think of right now are to somehow fiddle with the Streamlit library’s index.html and inject the script there, either by patching the local file or by having a proxy in front of it to do it on the fly.
Oh and then you want to trigger the logout from the backend side? yeah that should work depending on how your logout works I mentally was on client-side tracking / logging out (e.g. by automatically clicking on a logout button or so)
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.