IE11 performance.now()返回Infinity

时间:2018-03-06 02:54:56

标签: internet-explorer-11

我已经确定了IE 11的performance.now() API返回Infinity的错误。我注意到只有在设置了以下注册表项时才会发生这种情况:

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main]
"TabProcGrowth"=dword:00000000

我已经在Win10和Server 2016上重新制作了这个。是否有解决方法?

1 个答案:

答案 0 :(得分:1)

您可以根据performance.now()Date.now()替换为您自己的功能。您失去了API的好处(例如亚毫秒精度和单调增加的时钟),但依赖于performance.now()的代码应该对更改无动于衷。

// Run this as early as possible for the most accurate start time
(function() {
  if(!isFinite(performance.now())) {
    var start = Date.now();
    performance.now = function() { return Date.now() - start; }
  }
})();