All Questions
Tagged with visibilitychange javascript
21
questions
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 ...
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 ...
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
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 ...
2
votes
1
answer
870
views
Browser visibilitychange event no longer fired on page navigation?
The MDN docs say that the visibilitychange event
fires with a visibilityState of hidden when a user navigates to a new page, switches tabs, closes the tab, minimizes or closes the browser, or, on ...
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 ...
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 ...
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
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 ...
1
vote
1
answer
550
views
Is there any way to know when a tab in the browser is covered by a window?
TL;DR: I'm working on a Chrome extension where I need to increase a count only when a tab is visible and not covered by another window. Is there any way to detect this?
I've tried using the Page ...
0
votes
1
answer
218
views
Prevent SMIL animation from pausing when switching between browser tabs
How to prevent SMIL animation from pausing when switching between browser tabs?
I have SVG clock that is animated using <animatetransform>. When you switch to another tab animation freezes and ...
5
votes
1
answer
609
views
Scroll event not fired in Chrome when document.hidden is true. Any workarounds?
The scroll event is never fired by Chrome when the page is hidden, despite the page is actually scrolling. That looks like something they implemented to reduce cpu and network usage for pages that are ...
7
votes
1
answer
630
views
Visibility API is not working after window.open in Chrome
I was trying to use Visibility API, but it is not working for a child. The minimal example to reproduce:
<script>
document.onvisibilitychange = () => {
console.log(document....
0
votes
0
answers
1k
views
visibilitychange gets called multiple times if using fullscreen api
I am using visibilitychange event of browser. All looks good.
After clicking on one of my buttons, I use fullScreen API to take website into fullscreen mode.
The issue that I have is ...