Reputation: 3439
I know about the new Fullscreen API but I can't find anywhere a way to check if the browser at this time is in fullscreen mode. I'm specifically interested about Chrome. Is it even possible?
I'm looking for something like this
window.addEventListener('load', function() {
if (FULLSCREEN) {
console.log('We are in full screen mode!')
} else {
console.log('Normal mode')
}
})
Upvotes: 1
Views: 3857
Reputation: 1
Why not use the simple method of pressing F11. In this way, you can see if Chrome is viewed in full-screen or normal mode. Maybe you can find some advice reding this article https://rocketfiles.com/articles/how-to-exit-full-screen-chrome. I have not used the API you request but will try. Maybe will write to you more information later that I can learn from my side.
Upvotes: -2
Reputation: 616
If the document is in fullscreen mode, document.fullscreenElement
will return the element that triggered the mode. When not in fullscreen, it returns null
. In some browsers you may need to use the prefixed version, document.webkitFullscreenElement
.
Upvotes: 6
Reputation: 175
As per the Fullscreen API mdn doc : https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API Its not supported in chrome.
Upvotes: 0