1

I am messing around with some web pages and was wondering if it is possible to tell if my page is not the active page on a web browser. I am looking to tell if my page is minimized or is not the current tab. I am not asking about a particular language, but more just wondering if it is possible to get this sort of information.

Josh Crozier
  • 233,099
  • 56
  • 391
  • 304
PFranchise
  • 6,642
  • 11
  • 56
  • 73
  • There is a new API called Page Visibility API. See [How to know a browser is minimized in javascript](https://stackoverflow.com/a/64229054/11667949) – Shivam Jha Oct 06 '20 at 15:35

2 Answers2

3

Yes, its totally possible, with javascript.

See these answers:

Determine whether webpage has foreground window focus/is active tab?

How to tell if browser/tab is active

Is there a way to detect if a browser window is not currently active?

Community
  • 1
  • 1
ipd
  • 5,674
  • 3
  • 34
  • 49
  • @ian Thank you sir. This is exactly what I was looking for. I was pretty sure there would be something like this in javascript, but I was not too familiar with it, so I was not where to look. – PFranchise May 01 '11 at 07:34
  • Haha I will. I plan no harm with this, just trying to see what all is possible. Could do some neat stuff with this I think. – PFranchise May 01 '11 at 07:39
  • 1
    All of these solutions use the ``blur`` event, which will fire if the user just focuses the address line, even if the page remains visible. Tested without jQuery on Seamonkey 2.0.14 – kiw May 01 '11 at 07:45
0

You can check it with Javascript and then send a message to the server. But since the user can alter/disable the script you can never know for sure.

jmcf
  • 29
  • 2