-1

I am trying to get indexOf to work in IE8, but I cannot seem to get it to happen. I have tried including the es5-shim using:

<!--[if lt IE 9]><script src="http://cdnjs.cloudflare.com/ajax/libs/es5-shim/2.0.8/es5-shim.min.js"></script><![endif]-->

I also tried using underscore.js. I put that as the first javascript file that is called on the page, but I still get the error in IE8 "Object doesn't support this property or method" when it hits an indexOf() call.

The page I am working on is old and has frames and there is no DOCTYPE declared at the top of the page. Is this why this doesn't work? I have tried adding in a DOCTYPE, but that seems to break all of the formatting of the pages.

Any ideas? What other info do you need? Thanks so much.

jberek
  • 43
  • 1
  • 5
  • this page might help -- http://stackoverflow.com/questions/3629183/why-doesnt-indexof-work-on-an-array-ie8 – sfletche May 01 '14 at 19:45
  • Just use the polyfill from [MDN](http://mdn.io/indexOf). – nietonfir May 01 '14 at 19:55
  • 1
    How are you attempting to use `.indexOf()`? Can you provide an example that demonstrates the error? It's possible the object you're trying to use it with isn't an actual `Array`. – Jonathan Lonowski May 01 '14 at 19:56
  • I am trying to use the [selectize.js](http://brianreavis.github.io/selectize.js/) plugin for jQuery and it uses the indexOf for some arrays. That site says to include the es5-shim in the page, which I am doing, but I still get the error in IE8. So I was just trying to figure out why that is not working when it works for other sites in IE8. – jberek May 02 '14 at 20:33

1 Answers1

1

You might also mention what you are trying solve using indexof() as there may be other ways of solving your problem by using different methods that have nothing to do with indexOf().