【问题标题】:SCRIPT5007: Unable to get property 'cssRules' of undefined or null reference IE8 IssueSCRIPT5007:无法获取未定义或空引用的属性“cssRules” IE8 问题
【发布时间】:2014-03-18 12:22:27
【问题描述】:

我已经在我的项目中实现了 jwplayer 6,但在 IE8 控制台中出现错误 SCRIPT5007:无法获取未定义或空引用的属性“cssRules” 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

function 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;
}

}

【问题讨论】:

  • 当我点击链接时,我看到的是 Adob​​e Presenter,而不是 JW Player?
  • 感谢 Ethan 只是在 IE8 的情况下看到控制台中的错误
  • 连在 IE8 虚拟机中播放视频都看不到,让我给你看看我的脚本
  • 我正在使用 Jwplayer6 的许可版本
  • 我什至在任何浏览器中都看不到播放器?

标签: html jwplayer


【解决方案1】:

我也遇到了这个错误。似乎 IE8 中存在一个他们尚未解决的 jwplayer 错误。我没有过多研究它,但看起来 IE8 可能在 JS 之前没有加载样式表,从而使 document.styleSheets[0].cssRules 之类的东西成为空对象。该错误似乎在整个页面加载后消失(通过代码进行第二次迭代),但此时为时已晚。

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/

无论如何,我的快速解决方法是阻止 html5 js 在 IE8 中加载:

<!--[if (gt IE 8)|!(IE)]><!-->
  <script src="jwplayer.html5.js" type="text/javascript"></script>
<!--<![endif]-->

IE8使用的是flash版本,所以不需要这段代码。

【讨论】:

  • 我知道这不是对错误的实际修复,但如果这对您有帮助,您认为您可以将我的答案标记为正确吗?
【解决方案2】:

更好的方法是也添加这两个块:

<!-- 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]-->

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-08-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-25
    • 1970-01-01
    • 2017-07-05
    • 2014-02-03
    相关资源
    最近更新 更多