Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
OnResize infinite loop on IE 8
Message
De
14/02/2014 19:37:46
 
 
À
Tous
Information générale
Forum:
Javascript
Catégorie:
Autre
Titre:
OnResize infinite loop on IE 8
Divers
Thread ID:
01594364
Message ID:
01594364
Vues:
43
On Windows 7 with IE 8, the following code causes the browser to run in an infinite loop:
window.onresize=ResizeWindow

function ResizeEnvironment()
{
   BrowserDimension()
   loObject=window.parent.document.getElementById("Table1")
   loObject.style.width=nBrowserWidth+"px"
   lnHeight=nBrowserHeight-88
   loObject.style.height=lnHeight+"px"
   loObject=window.parent.document.getElementById("TD2")
   loObject.style.width=nBrowserWidth+"px"
   loObject.style.height=lnHeight+"px"
}
The situation is that I have an event that once the page is loaded, it will call ResizeEnvironment(). So far so good, the method is being called and the code inside this function is being executed. But, note that in the default SCRIPT code, I have window.onresize=ResizeWindow. So, in ResizeEnvironment(), once loObject.style.height=lnHeight+"px" is executed, this will send a call to ResizeWindow().

This code is not perfect and I just discovered that today. It worked for two years. However, only today we found out that Windows 7 with IE 8 will freeze with that code. So, I need to find a way to avoid this situation by enhancing the code so it will not break in that specific environment.

I tried to remove the event in the first line of ResizeEnvironment() and add it back at the last line of ResizeEnvironement(). This works but is not supported in IE 8. Some people are using a timer to make sure specific code is not fired twice. But, that did not work very well as well.

Any comment on how to better do that?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform