Questions tagged [visibilitychange]
The visibilitychange tag has no usage guidance, but it has a tag wiki.
visibilitychange
31
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
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 ...
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 ...
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 ...
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 ...
3
votes
1
answer
2k
views
At first only Default time bar disappears after timeout and then again after timeout full controller disappears of Exoplayer
As shown in the image and video, I am facing an issue while using styled player view.
I have set controllerShowTimeoutMs to 2 seconds, but I am getting results as shown in the below image...
Or as In ...
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 ...
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 ...
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....
1
vote
1
answer
442
views
document.visibilityState value not as expected with mapTo() operator
The value of document.visibilityState returned by the mapTo() operator when used as a pipe with an observable of the document.visibilitychange event is not as expected.
fromEvent(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 ...
-3
votes
3
answers
772
views
In Angular, how to prevent a user from changing from the current tab?
I have an exam application where we would like to prevent users from changing tabs or opening new tabs during the exam as a security measure. Can you suggest ways to achieve the same?
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. ...
0
votes
1
answer
717
views
Trying to make button appear onmouseover [duplicate]
I am trying to make it so that when i mouse over where this button is, it appears.
here is my code
html:
<div class="hide"><button type="button" onmouseover="appear()" id="button">LIGHT!...
0
votes
0
answers
207
views
How to know that my website is hidden when user locks the ios device? [duplicate]
I want to know when my website is hidden on iOS. I tried using event listener for visibilitychange event:
document.addEventListener("visibilitychange", function() {
if (document.visibilityState === ...
12
votes
2
answers
8k
views
Document visibilitychange versus window blur/focus, what is the difference, when to use which?
In ECMAscript (=Javascript) there are two ways to check if the user is away from your page or not. You can either listen for a "visibilitychange" event on the document or you can listen for "blur" and ...
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 ...
1
vote
1
answer
1k
views
Flickers while layout visible/gone
Is there any way to hide a view without flickering its above view?
I am trying to hide a View below MapView. Once I set its visibility to GONE, MapView flickers. As I have to add more markers ...
0
votes
1
answer
582
views
Tizen Wearable Web Widget visibilityChange and Debug
I am having some problems with Tizen wearable Web Widgets.
I just created a sample project with HTML + JS and tried to update page on events described in life-cycle -> On load / visibility change
...
1
vote
1
answer
1k
views
document.hidden is incorrectly false when used in a WebBrowser control
I want to detect when a window is minimized in JavaScript, so I am using document.hidden. In the below snippet, click "Start" and minimize the window by clicking the minimize button, toggling the ...
1
vote
2
answers
4k
views
How to pause video when click on new tab using javascript?
I'am working on video HTML Tag i want pause the audio when new Tab is open. Pls help to fix this issue.
<video autoplay onplay="clickplayer()" id="player" onended="endplayer()" fullscreen="true" ...