Erica Stockwell-Alpert
Erica Stockwell-Alpert

Reputation: 4853

IE11: indexOf() not working on one page, but working on others

I have several pages that use the same script, and on one page I'm getting the error "Object doesn't support property or method 'indexOf'". The error is on this line:

var giftBChecked = this.config.giftFeatures[giftB].indexOf(i) < 0 ? '' : checkimg;

In the debugger, I verified that this.config.giftFeatures[giftB] is an array. When I step through the code, I can see that it is an array of size 8, but then I get the 'indexOf' error anyway.

So it's not a compatibility issue, my variable that I'm using indexOf on is not null, and the script works without error in other pages.

You can see yourself here:

Not working

Working

What is causing it to break on that one page?!

Upvotes: 1

Views: 4749

Answers (1)

aquinas
aquinas

Reputation: 23786

On the page that isn't working you have a meta tag:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8">

That's telling the browser to emulate IE 8. IE is dutifully cooperating and acting like IE 8. IE 8 doesn't support indexOf on arrays, that didn't come until IE 9.

Upvotes: 10

Related Questions