如何在Firefox中以编程方式更改about:config dom.max_script_run_time值? [英] How to programatically change the about:config dom.max_script_run_time value in Firefox?

查看:250
本文介绍了如何在Firefox中以编程方式更改about:config dom.max_script_run_time值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道是否可以通过任何方式在Firefox about:config 窗口中以编程方式更改 dom.max_script_run_time 值.

I am just wondering if there is any way to programatically change the dom.max_script_run_time value in the Firefox about:config window.

当Firefox中的默认值为10时,我认为它太少了,无法在我的网站上运行较长时间的脚本.在将值设置为默认值(ie10)时,我的Firefox变为无响应,并且收到警告消息,如警告:脚本无响应,我只需要将值设置为20或30,以避免此类警报经常弹出,并使脚本运行更长的时间.

When the default values in my Firefox is 10, I think its too less to run a script running for longer time in my website. On when the value is set to default(i.e.10) my firefox goes Not Responding and I get warning alert message like Warning: Unresponsive Script I just need to set the value to 20 or 30 to avoid any such alerts popping often and let the script to run for longer time.

因此,我只需要在每次加载页面时更改 dom.max_script_run_time .

So I just need to change the dom.max_script_run_time each time the page gets loaded.

我已经在Firefox,Chrome,Safari,Palemoon和Opera等其他浏览器中对此进行了测试.

I have tested this in other browsers like Firefox, Chrome, Safari, Palemoon and Opera..

我仅在Firefox中有此问题

I have this problem only in Firefox

或者除了更改设置和加载页面外,还有其他方法吗?

Or is there any other way rather than changing the settings and loading the page?

任何解决方案将不胜感激.

Any solution will be appreciated.

推荐答案

无论如何,我找到了另一个解决此问题的方法.那就是从页面速度洞察中推迟加载JS概念.从此处获得了帮助.我在下面添加了代码页面加载后异步加载javascript文件.这将停止在Firefox中显示无响应脚本警告.

Anyway I found another solution to solve this problem. And thats Defered loading of JS concept from page speed insights. Got the help from here..I have added the code below to load the javascript file asynchronously after the page is loaded. This stops displaying the non responsive script warning in Firefox.

现在,存储在 someScript.js 中的所有javascript函数都在页面停止加载之后并且在这之间花费了很短的时间后立即被调用.但是就我没有得到无响应的脚本错误而言,那不是问题.

Now all my javascript functions stored in the someScript.js is called just after the page stops loading and with a small time elapsed in between. But thats not a problem as far as I don't get the unresponsive script error.

JS的延迟加载:

<script type="text/javascript">

// Add a script element as a child of the body
function downloadJSAtOnload() {
     var element = document.createElement("script");
     element.src = "/js/someScript.js";
     document.body.appendChild(element);
}

// Check for browser support of event handling capability
if (window.addEventListener)
    window.addEventListener("load", downloadJSAtOnload, false);
else if (window.attachEvent)
    window.attachEvent("onload", downloadJSAtOnload);
else 
    window.onload = downloadJSAtOnload;

</script>

这篇关于如何在Firefox中以编程方式更改about:config dom.max_script_run_time值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆