JWPlayer Not Working for Internet Explorer 8 [closed]

杀马特。学长 韩版系。学妹 提交于 2019-12-12 03:57:48

问题


For some reason Internet Explorer 8 and below does not run JWPlayer and I have referenced everything correctly. Why won't video work on jwplayer?

It seems as if jwplayer isn't even loading in IE8 or below.

Can you somebody help me?


回答1:


window.outerWidth is undefined in IE8, therefor your conditional evaluates to false and the JWPlayer code never runs.

Really not that hard to have debugged yourself. A simple alert or console.log in the conditional shows it isn't running, then you deduce it might be because the conditional itself is evaluating wrong, then a simple alert or console.log of window.outerWidth shows it is undefined.

Same problem with a potential solution: https://stackoverflow.com/a/5954761/1217408

Using document.body.clientWidth as pointed out there, something like this should work:

if((window.outerWidth && window.outerWidth > 640) || (document.body.clientWidth && document.body.clientWidth > 640)){

You should keep in mind that in IE this might include the scrollbar when calculating the available width. They are not exactly equivalent but if you're careful or mindful of it then you shouldn't have any problem.



来源:https://stackoverflow.com/questions/12983801/jwplayer-not-working-for-internet-explorer-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!