我已经在项目中实现了jwplayer6,但在IE8控制台SCRIPT5007中遇到错误: Unable to get property 'cssRules‘of undefined or null reference jwplayer.html5.js,第9行字符34
是什么导致了这个问题?
这是屏幕截图

和链接http://dev.www.infopave.com/Page/Index/PRESENTATIONS
点击任何视频链接并在IE8中查看控制台,IE9任何帮助都将得到高度评价。
谢谢
以下是我的代码
// Get Jwplayer Events and submit to google analytics add by noor03/12/2014函数LoadVideoDynamically(VideoFileName,VideoFileTitle,VideoPageURL) {
jwplayer("mediaplayer").setup({
file: VideoFileName, //exp //file: 'rtmp://s1nu7pjztotbeg.cloudfront.net/cfx/st/mp4:Help/How_To/GettingStarted_V2-Med_x264.mp4',
width: "100%",
height: "545",
autostart: true,
events: {
onComplete: function (event) {
ga('send', 'event', 'Video Completes', ''+VideoFileName+'', '' + VideoFileTitle + '');
},
onReady: function (event) {
ga('send', 'event', 'Video Plays', '' + VideoFileName + '', '' + VideoFileTitle + '');
}
}
});
function setText(id, messageText) {
document.getElementById(id).innerHTML = messageText;
}}
发布于 2014-03-28 05:41:36
我也收到了这个bug。看起来IE8中有一个jwplayer bug,他们还没有解决这个问题。我没有过多地研究它,但是看起来在JS之前,IE8可能不会加载样式表,从而使像document.styleSheets[0].cssRules这样的东西成为空对象。bug似乎在整个页面加载(代码的第二次迭代)之后就消失了,但在这一点上已经太晚了。
http://www.longtailvideo.com/support/forums/jw-player/bug-reports/30546/cssrules-error-in-ie8-script5007/ http://www.longtailvideo.com/support/forums/jw-player/bug-reports/35845/ssheetcssrules-is-null-or-not-an-object-error-in-ie8/
无论如何,我的快速解决方案是阻止在IE8中加载html5 js:
<!--[if (gt IE 8)|!(IE)]><!-->
<script src="jwplayer.html5.js" type="text/javascript"></script>
<!--<![endif]-->IE8使用闪存版本,因此不需要此代码。
发布于 2020-09-19 16:22:09
更好的方法是添加这两个代码块:
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<!--[if (gt IE 8)|!(IE)]><!-->
<script src="jwplayer.html5.js" type="text/javascript"></script>
<!--<![endif]-->https://stackoverflow.com/questions/22479261
复制相似问题