Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

detecting external windows active #56

Open
Kuhlig opened this issue May 6, 2020 · 2 comments
Open

detecting external windows active #56

Kuhlig opened this issue May 6, 2020 · 2 comments

Comments

@Kuhlig
Copy link

Kuhlig commented May 6, 2020

HI
the demo is working well when i change Tab in a browser (chrome/firefox) but when i activate an other application, like notepad (or from firefox to chrome) there is no entry in the log? is there any way to detect that?
thanks rob

@Drumstix42
Copy link

HI
the demo is working well when i change Tab in a browser (chrome/firefox) but when i activate an other application, like notepad (or from firefox to chrome) there is no entry in the log? is there any way to detect that?
thanks rob

If you check out https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API you'll see there's a note that mentions the normal browser "focus" functionality;

Note: While onblur and onfocus will tell you if the user switches windows, it doesn't necessarily mean it's hidden. Pages only become hidden when the user switches tabs or minimizes the browser window containing the tab.

If you really want to check if a window/page is in focus, you can use those built-in events. Just remember that users with multiple monitors or non-fullscreen windows can still technically "see" the page (potentially), and handle accordingly!

@Drumstix42
Copy link

Author responded to another similar issue here: #42 (comment)

There's a legacy mode you can use in a newer (not "released" yet) that you can utilize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants