问题
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