sindresorhus/screenfull

Uncaught (in promise) TypeError: fullscreen error

nicky132 opened this issue · 3 comments

image

image

Hope someone solve this problem.
I want to open page fullscreen automatically, when i jump to the new page with window.location.href.

Hi @nicky132 ,

Could you possibly try wrapping your function call in a conditions like this.

if (screenfull.isEnabled) {
    screenfull.toggle();
}

This seemed to fix my problem.

Hi @nicky132 ,

Could you possibly try wrapping your function call in a conditions like this.

if (screenfull.isEnabled) {
    screenfull.toggle();
}

This seemed to fix my problem.

I tried this but I am still getting the error.
The strange thing is that despite the error it still goes into fullscreen mode

Could you try using
if (screenfull.isEnabled) { screenfull?.toggle(); }
It worked for me. it either executes when available or returns undefined.