Use the fullscreenchange event to detect a full-screen change event, or if you do not want to handle provider prefixes, than you can also listen for the resize event (a window resize event that also fires when you enter full-screen mode or), and then check to see if document.fullscreenElement matters document.fullscreenElement is null to determine if fullscreen is enabled. You will need the prefix of the fullscreenElement provider accordingly. I would use something like this:
var fullscreenElement = document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
https://msdn.microsoft.com/en-us/library/dn312066(v=vs.85).aspx has a good example for this, which I quote below. They used the fullscreenChange event, but you could listen for the "resize" event
document.addEventListener("fullscreenChange", function () { if (fullscreenElement != null) { console.info("Went full screen"); } else { console.info("Exited full screen"); } });
Parth source share