IE 8 Script438错误

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了IE 8 Script438错误相关的知识,希望对你有一定的参考价值。

再次是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);  
    }

因此,'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 library是提供跨浏览器支持的最简单方法

以上是关于IE 8 Script438错误的主要内容,如果未能解决你的问题,请参考以下文章

ie8中不支持Object.create

无法解决 jquery IE 7/8 Script 3 Member not found 错误

prepend/append 适用于 Chrome 和 Firefox,但不适用于 IE11 和 Edge

JavaScript endsWith在IEv10中不起作用?

Powerpoint VBA 运行时错误 438(简单)

IE 11 Script1002 Array.Filter(x => ...)(箭头函数)