How to programatically change the about:config dom

2019-02-18 01:10发布

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.

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.

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

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

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.

3条回答
2楼-- · 2019-02-18 01:43

Set integer to 1000 or 0 at about:config dom.max.script_run_time.

I have found this to be a reliable fix and Firefox no longer has the

Warning: Unresponsive Script error message, runs alot faster and is an

immediate fix.

查看更多
男人必须洒脱
3楼-- · 2019-02-18 01:52

definitely, you can't change that value via web. I'm 100% sure

you should try to redesign your scripts and make your pages lighter

for example you should avoid, sadly, on firefox, as best you can

  • border-radius
  • box-shadow
  • text-shadow
  • dynamic gradients like -moz-linear-gradient -moz-radial-gradient etc
  • transitions/animations and transforms
  • frequent text rendering and re-rendering
  • huge backgrounds especially with background-attachment:fixed
  • flash objects, canvas, svg
查看更多
趁早两清
4楼-- · 2019-02-18 01:52

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.

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.

Deferred Loading of 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>
查看更多
登录 后发表回答