Detect When Users Switch Tabs - Page Visibility API in JavaScript

preview_player
Показать описание
In this video tutorial I'll be showing you how to detect when a user switches tabs on your web page, using the Page Visibility API in JavaScript.

Support me on Patreon:

For your reference, check this out:

Follow me on Twitter @dcodeyt!

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!

#dcode #javascript #webdev
Рекомендации по теме
Комментарии
Автор

Hey Dom,
Thanks for the video, but I reckon this way only serves half of the aim of saving resources and stopping resource intensive tasks, as this doesn't work when we switch to another window [ visibilityState remains the same ].
Is there is way to find out an active tab in an active window? I've got a similar situation in a project I'm currently working on. Looking forward to a video for the same.
This video was awesome. Something is always better than nothing.
Great work, keep it up mate..

adwaitungal
Автор

Great video😀 But sir I have a question 🙋‍♂️ Can I bypass the tab change. I.e. How I can shift the tabs and windows without letting the software know?

sarthakghosh
Автор

hey what if a student uses 2 monitor does it also get detected?

SpryE
Автор

Would be very happy to find a way to detect on which screen in a multiple screen setup a page is viewed.

webosm
Автор

does this affect the application running in background like download or something else

agrimnigam
Автор

This is a very informative video. I have a question, Is there any way to control the browser's tabs I mean when I open a page then i am not able to change tab any way ?

muhammadkamran
Автор

Great video! What are your thoughts on ColdFusion?

seancmptn
Автор

Does it work, if the user doesnt minimize, but just switches to completely new browser window? (not just a tab)

kushovna
Автор

thx now i can fail my students easily XDDD

aybakk