Checking if browser is in fullscreen [duplicate]
Possible Duplicate:
Detecting if a browser is in full screen mode
Is there a way to check if a browser is currently in fullscreen mode (after the user pressed f11)?
Something like:
if (window.fullscreen) {
// it's fullscreen!
}
else {
// not fs!
}
Thanks.
Steerpike's answer is pretty good, but my comment:
Thanks a lot, but this answer is not sufficient for FF. In Chrome I can set a small tolerance, but in FF the urlbar and tabs takes a while to disappear, which means after pressing f11, the detected window.innerWidth is still too small.
Solution 1:
This works for all new browsers :
if (!window.screenTop && !window.screenY) {
alert('Browser is in fullscreen');
}
Solution 2:
In Firefox 3, window.fullScreen works (https://developer.mozilla.org/en/DOM/window.fullScreen).
So, you could potentially do something like this:
if((window.fullScreen) ||
(window.innerWidth == screen.width && window.innerHeight == screen.height)) {
} else {
}