The moose likes HTML, CSS and JavaScript and the fly likes Internet Explorer Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Internet Explorer Problem" Watch "Internet Explorer Problem" New topic

Internet Explorer Problem

Guy Shahar

Joined: Dec 23, 2005
Posts: 22
My new site ( changes size depending on the size of the user's screen, and also gives users the chance to choose a larger or smaller text version. This seems to work fine on most browsers (IE, Mozilla, Netscape) - EXCEPT that when the height of the screen is below around 540 pixels, Internet Explorer freezes and closes when attempting to change the size of the text. The other browsers work fine and report no javascript errors or anything. It means that some users on widescreens will have enormous problems with the site on IE. Can anyone throw any light on this and advise me how I can avoid it.
Maximilian Xavier Stocker
Ranch Hand

Joined: Sep 20, 2005
Posts: 381
Woah that site has a lot of scripting. Anyway IE is croaking on line 73. But that's line 73 counting all the lines for the external script files includes so it's a bit hard to say. As a guess I would say somewhere in the dimensions function. However it seems to be calling it recursively whatever it is and that's what causes the lockup.

I would recommend putting all the source embedded into the HTML for starters. That will at least help in getting the actual line number of the error and then going from there.

But again from what I can tell there is some code that in IE not only causes an error but seems to make it cycle endlessly. Which is why it locks up. So another idea is to find any for loop or while loop or recursive function and make sure that it breaks out if a condition that you are counting on changing in your code could break upon failure. Maybe just a simple counter and if the function or loop gets called x times just return right out.
Guy Shahar

Joined: Dec 23, 2005
Posts: 22
Thanks Maximillian

Yes the scripting sort of grew to quite a large size (though you should see the size of the HTML.....)

Anyway, you inspired me to do some more investigating, and I found that the problem was with the line:

document.getElementById('css').href = css + 'css.css';

(which simply refers to the HTML line
link id = "css" rel = "stylesheet" type = "text/css" href = "mainshortcss.css" / )

Now, the site has 4 stylesheets: maincss.css, mainshortcss.css, largecss.css, largeshortcss.css. Here is some strange information about how things seem to be working:

1) With Mozilla and Netscape browsers there are no problems at all and everything is working fine.

2) With Internet Explorer, the stylesheets maincss.css and largecss.css are working fine.

3) In IE, if maincss.css or largecss.css are called using the javascript line above, they result in the browser freezing, BUT....

4) The problem cannot be with the stylesheets themselves because if maincss.css or largecss.css are called through the HTML link tag, everything works fine, even in IE.

What is going on....?
jQuery in Action, 3rd edition
subject: Internet Explorer Problem
It's not a secret anymore!