Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

a script on this page is causing ie to run slowly

The problem is in the title - IE is misbehaving and is saying that there is a script running slowly - FF and Chrome don't have this problem.

How can I find the problem . .there's a lot of JS on that page. Checking by hand is not a good ideea

EDIT : It's a page from a project i'm working on... but I need a tool to find the problem.

End : It turned out to be the UpdatePanel - somehow it would get "confused" and would take too long to process something. I just threw it out the window - will only use JQuery from now on :D.

And I'm selecting Remy Sharp's answere because I really didn't know about the tool and it seems pretty cool.

like image 636
sirrocco Avatar asked Oct 17 '08 15:10

sirrocco


People also ask

How do you stop a slow running script on Internet Explorer?

In the Internet Options window, open the Advanced tab. Under the Settings section, scroll down to Disable script debugging (Internet Explorer) under Browsing. Scroll down and uncheck the Display a notification about every script error box. Click Apply and OK to save the changes.

How do I stop scripts from running on my computer?

You have the choice of "Stop Script" or "Continue" buttons. Click the "Stop Script" button to stop the script from running. Stopping the script can prevent the browser from running out of memory or crashing.

How do I fix long running scripts in Internet Explorer 11?

First, go to the Settings section and scroll down to Browsing. Next, check the box associated with Disable script debugging (Internet Explorer). Next, look down below and uncheck the box associated with Display a notification about every script error.

Why do I keep getting a script error message on my computer?

A: Script error messages tend to appear when one's browser is out of date. What happens is the website you are visiting contains a version of JavaScript (the programming language that allows for animation and interactivity on websites) that is newer than what is installed on your browser.


2 Answers

Long running scripts are detected differently by different browsers:

  • IE will raise the warning once 5 million statements have been executed (more info on MSDN)
  • Firefox will warn if the script takes longer than 10 seconds (more info on MDN)
  • Safari will warn if the script takes longer than 5 seconds
  • Chrome (1.0) has no set limit and will simply keep trying until an OutOfMemory exception at which point it crashes
  • Opera will just continue to run forever, without warning.

Nicholas Zakas has written an excellent article covering this topic.

As such - the best way to avoid these problems is by reducing looping, recursion and DOM manipulation.

like image 195
nikmd23 Avatar answered Sep 24 '22 19:09

nikmd23


Get yourself a copy of the IBM Page Profiler:

https://www.ibm.com/developerworks/community/groups/service/html/communityview?communityUuid=61d74777-1701-4014-bfc0-96067ed50156

It's free (always a win). Start it up in the background, give it a few seconds, then refresh the page in IE. Go back to the profiler and it will list out all the resources used on the page and give you detailed profile information - in particular where JavaScript is taking a long time to execute.

It should be a good start to finding the source of your problem.

If the script tags are inline, I'd suggest creating a local copy of the file and separating out the script tags to separate files if you can.

like image 39
Remy Sharp Avatar answered Sep 22 '22 19:09

Remy Sharp