最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Detecting Event change in fullscreen mode Internet explorer - Stack Overflow

programmeradmin4浏览0评论

I am trying to write an event handler that detects whether a video player I have is in fullscreen or 'regular' mode.

I have tried using

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

but this doesn't work in IE, I have implemnted the same thing for firefox and chrome using webkitfullscreenchange and mozfullscreenchange event. Is there any other event I can use in IE for this? Or another way of doing this?

Any help would be appreciated. Thanks!

I am trying to write an event handler that detects whether a video player I have is in fullscreen or 'regular' mode.

I have tried using

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

but this doesn't work in IE, I have implemnted the same thing for firefox and chrome using webkitfullscreenchange and mozfullscreenchange event. Is there any other event I can use in IE for this? Or another way of doing this?

Any help would be appreciated. Thanks!

Share Improve this question asked Apr 17, 2013 at 20:20 lboyellboyel 2,2284 gold badges29 silver badges38 bronze badges 1
  • 1 Sorry to say, the HTML5 Full Screen API isn't supported in IE10, so I doubt anything but a hack will work. caniuse./#feat=fullscreen – DavGarcia Commented Apr 17, 2013 at 20:28
Add a ment  | 

2 Answers 2

Reset to default 13

You have jQuery, so use it:

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

});

(addEventListener isn't supported in versions earlier than IE 9 anyways)

At the same time, it doesn't look like full screen is supported in any version of IE:

  • http://caniuse./fullscreen

MDN Reference:

  • https://developer.mozilla/en-US/docs/DOM/Using_fullscreen_mode

Here's a possible hack around it:

  • onfullscreenchange DOM event

There is a jQuery plugin named jquery-fullscreen that will do exactly what you want. Until the Fullscreen-API standard has crystallized this is probably the best option.

You can also use the Modernizr fullscreen-api check and shim it if the browser doesn't support it by firing the event yourself (see this question for a detection method)

发布评论

评论列表(0)

  1. 暂无评论