Back to the Shapespark home page

Enter and exit Fullscreen programmatically

Is it possible to enter/exit fullscreen programmatically? Does the Viewer API have that option or any other ways to achieve that?

Fullscreen switch is possible via browsers API, it is unrelated to the Shapespark Viewer API. You can do it like this:

var element = document.body;
var requestFullScreenFn =
 element.mozRequestFullScreen ||
 element.webkitRequestFullscreen ||
 element.msRequestFullscreen ||
 element.requestFullscreen;
requestFullScreenFn.call(element);

This code needs to be executed after some user action, for example mouse button click, or keyboard click, otherwise browsers will deny the switch.

Jan, thank you for your prompt answer.