Weird IE "stop running this script?" error

A place to ask questions and get help. Be the first on your block to post ...

Weird IE "stop running this script?" error

Postby Erin Paseka » Thu Dec 02, 2010 5:33 pm

This is a bizarre question, but has anybody recently done anything to the template/sharedcode that would limit the number of links on a page in IE but not in other browsers?

Today we realized that our A-to-Z grad areas of study page, one of our biggest & most-viewed pages, in IE is slow and pops up a vague error message: "Stop running this script? A script on this page is causing Internet Explorer to run slowly. If it continues to run, your computer may become unresponsive. [Yes] [No]". If you say Yes to stop it, the page seems complete except the footer feedback thing has a drop-down instead of stars.

This is the page: http://www.unl.edu/gradstudies/prospect ... atoz.shtml . It seems fine in Firefox, Safari, Chrome, and Opera (once you get past the Opera-must-be-mobile bug). We haven't come across any other pages that have this problem.

I've spent hours trying different things. If I take it out of the template, the page loads fine & fast in IE. In the template, if I remove the part that creates all the "# A B C ... X Y Z" shortcut link lines, the page is still a little slow in IE but it loads without the script error popup. If I put in just the first 4 (# A B C) it works, but then it errors if I go one letter more. It seems like IE is just giving up because I've got too many links. 24x24 alpha shortcuts + hundreds of links to grad programs does turn into a huge number of links for just one page, but we've had it like this for quite a while and we've never run into this problem before.

Got any ideas? Or a tool that could diagnose this alleged script problem?
Erin Paseka
 
Posts: 147
Joined: Tue Jul 13, 2004 3:02 pm
Location: Graduate Studies

Re: Weird IE "stop running this script?" error

Postby kabel2 » Tue Dec 07, 2010 4:40 pm

It's not a "script problem" per se. The only time it is an issue is with the oldest supported version of IE (IE7). It is well known the IE7 is VERY slow when it comes to processing memory intensive loops (such is the case with the code that generates the content of your page).

If you are looking for a way to improve your code, I'd get rid of all the Array stuff. What you are really looking for is "Associative Arrays" which in javascript those are Objects. Simply defined as:
Code: Select all
var a = { "Key" : "Value" };

Optimizing the number of executable lines should speed things up, but I don't think it will be enough for IE 7.

The best solution to ensure IE 7 users don't see that warning, is to offset the JS that generates the page content until the rest of the DOM is "ready". This sort-of "AJAX" method tell browsers not to block the loading of the rest of the page while you are doing all your content building (since it's not done on the server side). You can accomplish this by replacing the following lines into your page's HTML:
Code: Select all
<div id="tableBlock">Loading...</div>

<script type="text/javascript">WDN.jQuery(function() {writePrograms();} );</script>
kabel2
 
Posts: 47
Joined: Tue Jan 17, 2006 10:33 pm
Location: University Communications

Re: Weird IE "stop running this script?" error

Postby Erin Paseka » Tue Dec 07, 2010 6:23 pm

Thanks! I put in that jQuery piece and the error popup is gone. Even as big as my script is, it loaded fast when I took it out of the template, so I guess this was a case of my js plus the WDN js cumulatively being too much for IE 7.

As for arrays/objects, I'm sure there's room for optimization in that page (and I do like the idea of not being personally responsible for quite so much coal being burned to load that monster) but I haven't found anything better that can support the structure of all that.
Erin Paseka
 
Posts: 147
Joined: Tue Jul 13, 2004 3:02 pm
Location: Graduate Studies

Re: Weird IE "stop running this script?" error

Postby Erin Paseka » Fri Feb 04, 2011 5:18 pm

Is there a way to make jQuery do an #include of an html file, or some equivalent?

The content of that page is primarily maintained elsewhere and just exported for the web as needed. My exporter had been dumping it as js that the browser had to chug through to generate the page, but I switched it to dumping plain html. (Partly as a workaround for a problem that's since been resolved, partly because it seemed like html should be less problematic.) But now the #include for the html content is causing the "script" error, even though there's not one bit of script in that file.

I #include the big html file: script error, but the content is there.
I take out the #include: no script error, but no content.
I make the #include point to some little dummy file: no script error, but no real content.
I replace the #include with the actual content of the big file: script error, but the content is there.
Erin Paseka
 
Posts: 147
Joined: Tue Jul 13, 2004 3:02 pm
Location: Graduate Studies

Re: Weird IE "stop running this script?" error

Postby CanadianSuperSpy » Tue Feb 08, 2011 3:01 pm

Is there a way to make jQuery do an #include of an html file, or some equivalent?
Yes. But if you can include with the server you should because an include by jQuery won't be indexed by search engines.

Post links separately to your problem files I bet I can help you track down the problem.
CanadianSuperSpy
 
Posts: 17
Joined: Wed Jul 23, 2008 1:22 pm
Location: CBA Room 13


Return to Help & Assistance

Who is online

Users browsing this forum: Yahoo [Bot] and 0 guests

cron