Question

I'm having a weird behavior with IE:

After some modifications on a Javascript enabled web page of mine, IE9 is not testing a string value correctly. I tried the same page on Safari and Firefox and it works (Who said no surprise?)...

Besides, when running locally with the Visual Studio integrated localHost engine, the modified page runs fine! Once the page is uploaded and run from the host website (ASP.NET 4.0) It doesn't "work" properly...

Now I tried on another PC with IE8 and... it works fine!

I suspect I have to reinstall IE9 on my PC?

Q1 - What do you web Gurus say? Q2 - How to reinstall IE on Windows Vista?

Update: the bad behavior happened after I added a string variable of 4 chars length and testing like this:

var a = "abcd"; // Actually a value taken from a hidden field

if (a[2] == somevalue) { Do this } else { Do that }

There is NO SCRIPT ERROR, but the result of the branching is wrong!

Was it helpful?

Solution

There is a bizarre misbehavior with IE9:

var a = "abcd"; // Actually a value taken from a hidden field

if (a[2] == somevalue) { Do this } else { Do that }

a[2] stays "undefined"! If you want it to work you must use the javascript substring function instead.

With Firefiox and Safari, a[2] is perfectly defined. And with the Localhost provided by Visual Studio it works fine as well!!! :-((

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top