admin管理员组

文章数量:1313794

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.

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.

Share Improve this question edited Jun 2, 2014 at 14:33 JonK 2,1082 gold badges27 silver badges37 bronze badges asked Feb 5, 2013 at 9:02 LuckyLucky 17.4k19 gold badges120 silver badges156 bronze badges 2
  • 1 Visitors do not like having their browser hung for 10 seconds, let alone 30 seconds. What are you trying to do? Usually, a workaround for this limit is using something like setTimeout. (you could also use WebWorkers if your application allows for it) – Lekensteyn Commented Feb 5, 2013 at 9:05
  • no the page does not hang or something..its only loading without errors and normally as expected..this change in setting only allows the firefox to run the scripts to run for longer time..performance of the page load does not get affected by this in any way.. – Lucky Commented Feb 5, 2013 at 9:15
Add a ment  | 

3 Answers 3

Reset to default 2

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

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>

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.

本文标签: javascriptHow to programatically change the aboutconfig dommaxscriptruntime value in FirefoxStack Overflow