I've used screenfull.js on a digital signage project where the requirement was that the application should be able to reload itself completely (using location.reload()) with the application staying in full screen. After some experimentation I settled on an <iframe> solution. This way the outer document could stay in full screen while the inner document reloads. A single click anywhere on the screen (typically using a remote control on a more or less smart TV) will toggle full screen mode. The javascript is run in the inner document.
In order to get this to work I had to make a small modification to the screenfull.js library. I added a targetDocument() method which allows you to manually override the document variable.
var screenfull = {
targetDocument: function (doc) {
document = doc;
},
request: function (elem) {
// ...
It fails on getting the isFullscreen property inside the toggle() method.
If you find the targetDocument() idea useful, I would very much appreciate it being added to the library. If I'm stupid (not unlikely) and have overlooked a more obvious solution please advice.
I've used screenfull.js on a digital signage project where the requirement was that the application should be able to reload itself completely (using
location.reload()
) with the application staying in full screen. After some experimentation I settled on an<iframe>
solution. This way the outer document could stay in full screen while the inner document reloads. A single click anywhere on the screen (typically using a remote control on a more or less smart TV) will toggle full screen mode. The javascript is run in the inner document.In order to get this to work I had to make a small modification to the screenfull.js library. I added a
targetDocument()
method which allows you to manually override the document variable.In my script I'm using it like so:
Doing this does not work:
It fails on getting the
isFullscreen
property inside thetoggle()
method.If you find the
targetDocument()
idea useful, I would very much appreciate it being added to the library. If I'm stupid (not unlikely) and have overlooked a more obvious solution please advice.