This question already has an answer here:
- webkitRequestFullScreen not working? 1 answer
Full screen is working in chrome and other browsers but not working in Safari. Here is my code:
var doc = window.document;
var docEl = document.getElementById("divId");
//doc.documentElement;
var requestFullScreen = docEl.requestFullscreen || docEl.mozRequestFullScreen || docEl.webkitRequestFullScreen || docEl.msRequestFullscreen;
var cancelFullScreen = doc.exitFullscreen || doc.mozCancelFullScreen || doc.webkitExitFullscreen || doc.msExitFullscreen;
if(!doc.fullscreenElement && !doc.mozFullScreenElement && !doc.webkitFullscreenElement && !doc.msFullscreenElement){
requestFullScreen.call(docEl);
} else {
cancelFullScreen.call(doc);
}
<div id="divId" style="width: 300px;height:60px" > FULL SCREEN </div>