IE和Edge中的Handsome主题加载问题
本文最后更新于 1434 天前,其中的信息可能已经有所发展或是发生改变。

最近在学校里面浏览博客的时候出现了一些文章加载不出来的情况,显示一直在转圈,因为学校里面不好操作,而且这个问题也从来没被复现过,于是就发现

-117af34ef6bf6cb1.jpg

是由于Handsome使用了Foreach()的问题

经过检验源码,发现Handsome在两个位置使用了Foreach()函数

Screenshot_20201218_222534_mark.via.png

Screenshot_20201218_222549_mark.via.png

所以,在Foreach使用前先自定义一个Foreach

// Production steps of ECMA-262, Edition 5, 15.4.4.18
// Reference: https://es5.github.io/#x15.4.4.18

if (!Array.prototype['forEach']) {

  Array.prototype.forEach = function(callback, thisArg) {

    if (this == null) { throw new TypeError('Array.prototype.forEach called on null or undefined'); }

    var T, k;
    // 1. Let O be the result of calling toObject() passing the
    // |this| value as the argument.
    var O = Object(this);

    // 2. Let lenValue be the result of calling the Get() internal
    // method of O with the argument "length".
    // 3. Let len be toUint32(lenValue).
    var len = O.length >>> 0;

    // 4. If isCallable(callback) is false, throw a TypeError exception.
    // See: https://es5.github.com/#x9.11
    if (typeof callback !== "function") { throw new TypeError(callback + ' is not a function'); }

    // 5. If thisArg was supplied, let T be thisArg; else let
    // T be undefined.
    if (arguments.length > 1) { T = thisArg; }

    // 6. Let k be 0
    k = 0;

    // 7. Repeat, while k < len
    while (k < len) {

      var kValue;

      // a. Let Pk be ToString(k).
      //    This is implicit for LHS operands of the in operator
      // b. Let kPresent be the result of calling the HasProperty
      //    internal method of O with argument Pk.
      //    This step can be combined with c
      // c. If kPresent is true, then
      if (k in O) {

        // i. Let kValue be the result of calling the Get internal
        // method of O with argument Pk.
        kValue = O[k];

        // ii. Call the Call internal method of callback with T as
        // the this value and argument list containing kValue, k, and O.
        callback.call(T, kValue, k, O);
      }
      // d. Increase k by 1.
      k++;
    }
    // 8. return undefined
  };
}

Screenshot_20201218_224046.png

/www/wwwroot/www.ioioi.cn/usr/themes/handsome/component/header.php44行左右的一个 <script type="text/javascript">中定格添加


  • [X]2020-12-18 22-42-20 等待明日去学校实验验证

直接放弃,更换ie为origin解析

[post cid=”228″ cover=”https://www.ioioi.cn/wp-content/uploads/2020/12/3096815211.png”/]

上一篇
下一篇