Jonas Grumann Jonas Grumann - 4 years ago 247
Javascript Question

Force Chrome (38) to exit full screen mode

I have a webpage that uses the history api to navigate between pages without complete page refreshs. It all worked great on desktop and mobiles until the last chrome update (38.0.2125.102) on Android (4.4.2).

The problem is with the full screen mode of the browser: when the user comes to our site there's a link to a video gallery, he clicks it and a lightbox opens up with a vimeo embedded video in it. He then taps the video to watch it and it goes fullsceen (a message appears on top that the browser is in fullscreen mode). If the user closes the video like suggested (by dragging down from the top) everything works as expected, but if he taps the devices 'back' button, the browser kinda closes the video (I can still hear it play somewhere) but doesn't really leave the full screen mode (messing up stuff until the user drags from the top).

I'm able to detect when the user has tapped that button, and my question is can I force the browser to leave the fullscreen mode through javascript?


Answer Source

As stated on the comment above:

On back button click you can check if the current document is in full screen (document.webkitIsFullScreen) and in case cancel it (document.webkitCancelFullScreen();).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download