Can anyone tell me if IE 7 and IE 8 support the JavaScript .indexOf() method as I am receiving the error:
SCRIPT438: Object doesn't support property or method 'indexOf'
from the IE9 debug console (used under both IE7 and IE8 Browser mode).
For the below comment, the code using .indexOf() is as follows:
if(shirt_colour == 'black') {
p_arr=['orange','red','green','yellow','bblue','rblue','pink','white','silver','gold'];
if( p_arr.indexOf(print_colour) != -1 ) rtn = true;
}
If you need
indexOf
in IE<=8, you should consider using the following polyfill, which is recommended at the MDN :Following code can be helpful.
On IE<9
indexOf()
it is not "well" implemented. Try to add this function on your code :It will "replace" the original function, if not found in the ECMA-262 standard.