IE 8 Script438错误

时间:2012-07-20 16:17:22

标签: javascript html internet-explorer-8 swfobject

再次使用Internet Explorer 8 ...

我一直在寻找SCRIPT438错误的解决方案(SCRIPT438:对象不支持此属性或方法),但它们似乎都不适用于我。

我正在使用swfobject.js并且F12控制台上的错误报告显示第435行第5行出现错误,此行:

el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';

该行是此功能的一部分:

function createSWF(attObj, parObj, id) {
    var r, el = getElementById(id);
    if (ua.wk && ua.wk < 312) { return r; }
    if (el) {
    if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
        attObj.id = id;
    }
    if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
        var att = "";
        for (var i in attObj) {
            if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
                if (i.toLowerCase() == "data") {
                    parObj.movie = attObj[i];
                }
                else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
                    att += ' class="' + attObj[i] + '"';
                }
                else if (i.toLowerCase() != "classid") {
                    att += ' ' + i + '="' + attObj[i] + '"';
                }
            }
        }
        var par = "";
        for (var j in parObj) {
            if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
                par += '<param name="' + j + '" value="' + parObj[j] + '" />';
            }
        }
        el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
        objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
        r = getElementById(attObj.id);  
    }

所以&#39; el&#39;不应该是未完成的

这是我将所有javascript添加到HTML

的方式
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>

<script src="js/smoothscroll.js"></script>
<script src="js/jquery.placeholder.min.js"></script>
<script src="js/javascript.js"></script>
<script src="js/swfobject.js"></script>
<script src="js/player.js"></script>

我没有两次包含jquery,jquery.placeholder是我用来解决占位符问题的插件,在源代码中可以找到ie9的源代码 https://github.com/mathiasbynens/jquery-placeholder

我必须解决这个问题,直到星期一,才能真正使用一些帮助

1 个答案:

答案 0 :(得分:0)

从实际意义上讲,如果您对项目使用编译,则可以考虑安装polyfill软件包

`stty sane`

npm i --save core-js

然后添加到项目入口点的顶部

yarn add core-js

目前core-js polyfill library是提供跨浏览器支持的最简单方法