IE 8 Script438 error

IE 8 Script438 error

本文关键字:error Script438 IE      更新时间:2023-12-23

Internet Explorer 8再次出现。。。

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

我正在使用swfoject.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);  
    }

所以'el'不应该是未定义的

这就是我将所有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

我必须在周一之前解决这个问题,真的需要一些帮助

从实际意义上讲,如果您的项目使用编译,您可能会考虑安装polyfill包

npm i --save core-js

yarn add core-js

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

import 'core-js'

目前,core-js-polyfill库是使跨浏览器支持的最简单方法