Is there an escape link for full screen

I’m using the following to allow the player to switch to a complete full screen. but requires keyboard press ESC to exit. Is there an equivalent code I can use to create a link to exit fullscreen? I noticed that reset will do this but also cleared unsaved progress. Thanks

setup.fullscreen = function (element) {
 if(element.requestFullScreen) {
 element.requestFullScreen();
 } else if(element.mozRequestFullScreen) {
 element.mozRequestFullScreen();
 } else if(element.webkitRequestFullScreen) {
 element.webkitRequestFullScreen();
 }
}

Macro.add('fullscreen', {
 handler : function() { 
 setup.fullscreen(document.documentElement);
 }
});

SugarCube has a whole FullScreen API you can use.

Simply having a button to toggle should help:

<<button "FS">>
    <<run Fullscreen.toggle();>>
<</button>>
2 Likes

Ok giving that a try now thanks.

Perfect. Thank you very much.