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.
document.fullscreenElement
to get element if it exists else it will benull
. Inner- and screen width are not reliable, for example, if you open dev tools the inner sizes will not be the same as screen sizes. You can assigndocument.onfullscreenchange
to this method to get an instant response when changing between fullscreen and off. – tscpp