gpt4 book ai didi

javascript - Phaser 使用 Firefox(隐藏 Iframe)崩溃为 null window.compulatedStyle()

转载 作者:行者123 更新时间:2023-12-03 01:17:18 27 4
gpt4 key购买 nike

所有 Phaser 游戏引擎游戏似乎都会崩溃并出现以下错误,但仅在 Firefox 中,当包含实际 Phaser 游戏的 iframe 由于显示游戏前视频广告而隐藏时。

Type Error "window.computedStyle() is null"

有什么解决办法吗?

最佳答案

我认为您拼错了错误:它是“window.getCompulatedStyle()”。

尝试使用这段代码:

    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;
}
};
}

关于javascript - Phaser 使用 Firefox(隐藏 Iframe)崩溃为 null window.compulatedStyle(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51948299/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com