-
Notifications
You must be signed in to change notification settings - Fork 491
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
document.hasFocus does not work in older Opera browsers and Opera Mini #367
Comments
We do use the Page Visibility API as well. f8d4574 is a fallback for when |
That is good but the issue is not if Page Visibility API is used or not. _this.visibilityChange(event); is never executed on click if |
Maybe a boolean _this.visibilityChange(event); should be executed or not. |
Fair enough. |
You can use Phaser CE game template, load it in any browser that does not support
hasFocus
(here is the table of browsers with their respected versions supporting this method https://www.w3schools.com/jsref/met_document_hasfocus.asp),
run it and click anywhere on the canvas.
Game should not break on mouse click.
Game breaks on mouse click and an error occurs:
This change
f8d4574#diff-3d1f84893e3059298765938e947d6639R266
now breaks any game played in a browser that does not support
hasFocus
method which includes older versions of Opera and Opera Mini.It should be checked if this method is available, use it if it is, and find another way to check if document has focus for browsers where it is not available.
This stack overflow thread might have a solution for that:
https://stackoverflow.com/questions/1060008/is-there-a-way-to-detect-if-a-browser-window-is-not-currently-active
The text was updated successfully, but these errors were encountered: