Javascript Phaser在Firefox(隐藏的Iframe)中崩溃到null window.computedStyle()

Javascript Phaser在Firefox(隐藏的Iframe)中崩溃到null window.computedStyle(),javascript,phaser-framework,Javascript,Phaser Framework,所有Phaser游戏引擎游戏似乎都会因以下错误而崩溃,但只有当包含实际Phaser游戏的iframe由于显示游戏前视频广告而被隐藏时,Firefox才会崩溃 类型错误“window.computedStyle()为空” 有什么解决方法吗?我想你拼错了错误:它是“window.getComputedStyle()” 尝试使用以下代码: if (/firefox/i.test(navigator.userAgent)){ window.oldGetComputedStyle = win

所有Phaser游戏引擎游戏似乎都会因以下错误而崩溃,但只有当包含实际Phaser游戏的
iframe
由于显示游戏前视频广告而被隐藏时,Firefox才会崩溃

类型错误“window.computedStyle()为空”


有什么解决方法吗?

我想你拼错了错误:它是“window.getComputedStyle()”

尝试使用以下代码:

    if (/firefox/i.test(navigator.userAgent)){
   window.oldGetComputedStyle = window.getComputedStyle;
   window.getComputedStyle = function (element, pseudoElt) {
      var t = window.oldGetComputedStyle(element, pseudoElt);
      if (t === null) {
         return {
            getPropertyValue: function(){}
         };
      } else{
         return t;
      }
   };
}

您需要提供一些代码。根据您提供的内容,我会猜测隐藏iframe的逻辑。Phaser版本(2或3)也会有帮助,尽管我不知道是否需要它。谢谢,这段代码是否应该位于包含Phaser.js的iframe页面内?我想应该是这样的