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 patibility 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?!
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 patibility 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?!
Share Improve this question asked Mar 3, 2015 at 21:06 Erica Stockwell-AlpertErica Stockwell-Alpert 4,86311 gold badges67 silver badges139 bronze badges 01 Answer
Reset to default 10On 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 e until IE 9.