Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 Can javascript check if current page is visible ?

views
     
TSnarf03
post Jul 12 2016, 02:31 PM, updated 8y ago

Look at all my stars!!
*******
Senior Member
4,544 posts

Joined: Dec 2004
From: Metro Prima, Kuala Lumpur, Malaysia, Earth, Sol


I want to know if there is a way to check if a page is visible or not, lets say i have an asp.net page that will constantly refresh itself, and i want it to stop refreshing if the page is not visible.

How do i know if
-browser is minimized, but the tab is active
-browser is restored, but the tab is inactive
-browser is restored, tab is active, but another window is 100% overlaps on the browser
WongGei
post Jul 13 2016, 09:59 AM

Regular
******
Senior Member
1,206 posts

Joined: Dec 2007
From: Kuala Lumpur
Check the Java script event, http://www.w3schools.com/jsref/dom_obj_event.asp

- onpagehide
- onresize
badai
post Jul 13 2016, 12:27 PM

Enthusiast
*****
Senior Member
986 posts

Joined: Jan 2003
window.onfocus
jurkflash
post Jul 14 2016, 12:11 AM

Getting Started
**
Junior Member
95 posts

Joined: Sep 2010
Yeah, the onfocus is all u need

 

Change to:
| Lo-Fi Version
0.0144sec    0.27    5 queries    GZIP Disabled
Time is now: 29th March 2024 - 05:22 AM