Thursday 11 March 2021

Fake Document.visibilityState in electron

Is there a way to fake the Document.visibilityState on an electron app? I need that for a website that doesn't correctly deal with losing focus (it only looks at Document.visibilityState and should be looking at blur also).

Minimizing the window works, but is not convenient.

EDIT: my use case is: I'm wrapping a website in an electron app. That website is looking at Document.visibilityState to know if the user is active or not. The problem is that if the user switches to another window, the visibilityState is still "visible". The site should also be looking at the blur/focus events, but it is not (it is not my website). I would like to handle the blur event myself (which I can), and fake the Document.visibilityState so knows that it is not visible or focused.



from Fake Document.visibilityState in electron

No comments:

Post a Comment