发布于 4年前

IE11 下 IE8 模式,angular 1.2.5 报错 SCRIPT445:对象不支持此操作

IE11 下 IE8 模式,angular 1.2.5 报错 SCRIPT445:对象不支持此操作。

报错位置

function i(t) {
    var e = n.console || {}, i = e[t] || e.log || $;
        return i.apply ? function () {
            var t = [];
            return o(arguments, function (e) {
                t.push(r(e))
            }), i.apply(e, t)
        } : function (t, e) {
            i(t, null == e ? "" : e)
        }
    }

根据 https://github.com/angular/angular.js/issues/5400 的说法,这几行代码是为了检测console.log是否有apply函数,https://github.com/angular/angular.js/blob/master/src/ng/log.js#L144 这里有行注释:

Note: reading logFn.apply throws an error in IE11 in IE8 document mode.
The reason behind this is that console.log has type "object" in IE8...

说了这么多有办法解决吗,其实直接ie8测试是没有问题的,只有在IE11下的IE8模式才会有这样的错误,也就是说,只要你不在IE11下开着IE8模式是不用担心用户出现这个问题的,O(∩_∩)O

©2020 edoou.com   京ICP备16001874号-3