1

Okay! So, I have what appears to be "too-complex a problem" right now. I have to open a URL provided by the user after a period of 10 seconds. And once that window is opened, I have to check if any other window or browser was opened in the next 10 seconds. If not, I just close the present window with an alert. If a window or browser was opened, I have to alert the user informing about it.

Been working on this for 4-5hours now. But, haven't found a thing.

Does anyone have any idea?

Thanks

  • 4
    The simple answer is you can't. For security reasons, you can't access information from other tabs/windows. – JCOC611 Oct 08 '12 at 02:00
  • or browser ? you are kidding ? try think about this in the following manner: "I want to alert user if his girlfriend had a call to cellphone." – zb' Oct 08 '12 at 02:02
  • We can't right? I have been given this question by employer to solve and it clearly says to detect if a new browser or window was opened!! :( Trick question??? –  Oct 08 '12 at 02:06

1 Answers1

1

The best you can do is to use the page visibility api to see if your window has been hidden by another window, or possibly an onblur handler to see if the user has switched to another window from yours. See here: Is there a way to detect if a browser window is not currently active? .

Community
  • 1
  • 1
glortho
  • 13,120
  • 8
  • 49
  • 45
  • Yeah. I did come across many things out here that talked about checking activity! But, nothing of the sort what I have been asked to do. And now I feel cheated because I wasted 4-5hours over something which cant be done. –  Oct 08 '12 at 02:12