JWPlayer Not Working for Internet Explorer 8 [clos

2019-09-09 19:25发布

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条回答
ゆ 、 Hurt°
2楼-- · 2019-09-09 20:06

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.

查看更多
登录 后发表回答