0

In implementing primefaces poll, I want to execute poll only if the browser tab is active/focused

Otherwise it should not poll data from backing bean as if multiple browser tabs are open, all the browser tabs will execute the poll regardless of being focused.

fareed
  • 3,034
  • 6
  • 37
  • 65
  • @Kukeltje I mean the browser tab – fareed Dec 09 '17 at 12:32
  • Break down your problem. Check if and how you can start/stop the poll e.g. via javascript (unrelated to the focus). Then search for generic solutions (not poll related) to check for/detect a focussed tab. It's always good to break down problems in to more manageable parts (easier to find (generic) answer for) – Kukeltje Dec 09 '17 at 12:44

1 Answers1

1

Effectively, this question is a duplicate of a combination of two other questions. I'll answer it here anyway to emphasize the relevance (need!) to always try to break down your problem in more generic and hence manageable parts for which you can find answers. In this case the 'two' questions are:

Both are more easily solvable via search engines than the combined one.

I put the google searches behind the 'list items' above.

This results in

Which combined will give you the solution you need.

Kukeltje
  • 12,223
  • 4
  • 24
  • 47