Questions tagged [visibilitychange]
The visibilitychange tag has no usage guidance, but it has a tag wiki.
visibilitychange
17
questions with no upvoted or accepted answers
6
votes
1
answer
2k
views
`visibilitychange` firing as "hidden" and not "visible" for new window initial load
I am launching a new tab and trying to add a visibilitychange handler for the window in order to add unload behavior, since all the docs recommend that over onunload and pagehide. My plan was to ...
5
votes
1
answer
2k
views
browser close not triggering the visibilityChange on safari
I am trying to save some statistics when the user closes the browser, below is the code
if (typeof document.hidden !== 'undefined') { // Opera 12.10 and Firefox 18 and later support
hidden ...
4
votes
1
answer
2k
views
Do not fire visibilitychange event on document reloads(refresh, page navigation) but fire on close browser, close tab, or switch tab
document.addEventListener("visibilitychange", onVisibilityChange, {
passive: true,
});
This will fire even when someone navigates away from my page. Ofcourse this is logical. But is ...
2
votes
0
answers
42
views
visibilitychange not firing on browser close in firefox
I am trying to send some data for analytics on browser close and the visibilitychange event listener is not being triggered on browser close on firefox. This works as expected in chrome.
MDN says this ...
2
votes
0
answers
546
views
Switching fullscreen triggers a "visibilitychange" event on safari
On Safari (15.3) on Macos (11.6.4), and possibly on ios too, enabling and disabling fullscreen triggers a "visibilitychange" event. It doesn't on Chrome and Firefox.
Is there a simple way to ...
2
votes
0
answers
3k
views
Why is my fetch keepalive call on page unload failing in Safari?
I need to send back a bit of data for reporting when the user closes or leaves a specific page. So I set up an API endpoint and am using window.fetch with the keepalive flag set to make sure that the ...
2
votes
0
answers
548
views
JavaScript/PHP: Track the video watching time of a user on a web page?
My customer offers a video tutorial site where both teachers and students can register. The students' video watching time for each video should be tracked in order to give feedback to the teachers. ...
1
vote
0
answers
493
views
Detecting browser tab crash in mobile Safari
We are building a web application that sometimes crashes in Mobile Safari due to a jetsam event, where the OS kills the process because of bad memory usage. We think we have a handle on the bug, but ...
1
vote
0
answers
51
views
Visibility.js doesn't fire state change
In my react project have visibility.js package imported, which I am using to re-render page if user opens web view from background and more then 5 min is passed, inside one of my hook I have simple ...
0
votes
0
answers
28
views
How much time do I have to save data to local storage when browser visibility changes to hidden?
I want to save page data to local storage upon tab close or reload. I am saving data upon visibilitychange event to hidden. I've read this is the recommended way to do so per Page Lifecycle API and ...
0
votes
1
answer
56
views
How to Warn Users Before Changing Tabs or Minimizing Window During an Online Quiz?
I am conducting an online quiz,
Here is what I want to achieve:
Detect when a user tries to switch tabs or windows.
Detect when a user tries to minimize the window.
Display a warning message before ...
0
votes
0
answers
28
views
When switching from safari to another and then back to safari, I can't detect that safari has been reopened consistently (React Native)
I am building a react-native / expo application that I am running as a web app. When I tab out of safari, and wait 10-15 seconds and tab back into it, my application is not consistently reconnecting ...
0
votes
0
answers
29
views
How do I hide an entire HTML page, but make the page still renders and still exist?
I'm making an extension to hide the ChromeOS bookshelf by displaying a completely hidden tab, so the device would register a window being drawn, but the user could not interact or notice it.
This is ...
0
votes
0
answers
41
views
Android - Why this TextView is moving its position after changing its visibility programmatically?
Initially both TextViews are visible and aligned correctly:
After clicking the Button, I set both TextViews visibility to GONE. Second time I click on the Button, I set the visibility again to ...
0
votes
0
answers
888
views
Visibility Detector flutter
I am using visibility detector in flutter to check for 100% visibility of a widget. But even when the widget is behind a fixed app bar the visibility detector considers it to be 100% visible. What is ...