Detecting event changes in full screen mode Internet explorer

I am trying to write an event handler that determines if I have a video player in full screen or "normal" mode.

I tried using

document.addEventListener("fullscreenchange", myfunc, false); 

but this does not work in IE, I implemented the same for firefox and chrome using the webkitfullscreenchange and mozfullscreenchange event. Is there any other event that I can use in IE for this? Or another way to do this?

Any help would be greatly appreciated. Thanks!

+4
source share
3 answers

You have jQuery, so use it:

 var screen_change_events = "webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange"; $(document).on(screen_change_events, function () { }); 

( addEventListener not supported in versions earlier than IE 9 anyway)

At the same time, it does not look like full-screen mode in any version of IE:

MDN Link:

Here you can hack it:

+9
source

There is a jQuery plugin called jquery-fullscreen that will do exactly what you want. While the Fullscreen-API standard is not crystallized, this is probably the best option.

You can also use Modernizr fullscreen-api check and pin it if the browser does not support it by triggering an event (see this question for the detection method)

+1
source

download script: https://raw.githubusercontent.com/sindresorhus/screenfull.js/gh-pages/dist/screenfull.js

use this code:

 if (screenfull.enabled) { screenfull.onchange(() => { icono_full(screenfull.isFullscreen); }); } function icono_full(x) { if (x == true) { //do when full screen is on } else { //not full screen } } 

see https://github.com/sindresorhus/screenfull.js

-1
source

All Articles