Error message
In a recent Firefox (64.0) you'll see this error:
TypeError: The expression cannot be converted to return the specified type.
in Chrome (71.0.x):
TypeError: Document not active
Cause
A rather meaningless and unhelpful error message occurs when one tries to exit fullscreen via javascript if the document isn't actually in fullscreen mode.
Solution
The solution is to check whether we are currently in fullscreen mode.
Snippet
Run it in jsfiddle, for testing the fullscreen mode.
See also
https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullScreen
https://developer.mozilla.org/en-US/docs/Web/API/DocumentOrShadowRoot/fullscreenElement
No comments:
Post a Comment