Do it like this…
if (!Array.prototype.indexOf) {
}
As recommended compatibility by MDC.
In general, browser detection code is a big no-no.
More Related Contents:
- 5 stars and the golden 5 stars are not together (When browsing with Internet explorer)
- ‘innerText’ works in IE, but not in Firefox
- JS li tag onclick not working on IE8
- ‘console’ is undefined error for Internet Explorer
- Why doesn’t indexOf work on an array IE8?
- javascript document.getElementsByClassName compatibility with IE
- Fixing JavaScript Array functions in Internet Explorer (indexOf, forEach, etc.) [closed]
- How can I prevent the backspace key from navigating back?
- Does IE8 out-of-the-box have support for ‘localStorage’
- PNG transparency issue in IE8
- How to make Internet Explorer emulate pointer-events:none?
- How to handle lack of JavaScript Object.bind() method in IE 8
- Cross-browser (IE8-) getComputedStyle with Javascript?
- IE8 alternative to window.scrollY?
- How can I use console logging in Internet Explorer?
- Can’t dynamically add rows to a in IE?
- postMessage still broken on IE11?
- What is JavaScript’s highest integer value that a number can go to without losing precision?
- Date constructor returns NaN in IE, but works in Firefox and Chrome
- JavaScript: Which browsers support parsing of ISO-8601 Date String with Date.parse
- How do I do OuterHTML in firefox?
- Is there an Internet Explorer approved substitute for selectionStart and selectionEnd?
- getting access is denied error on IE8
- Could not complete the operation due to error 80020101. IE [duplicate]
- Saving text in a local file in Internet Explorer 10
- Is there any problem with using HTML5’s “data-*” attributes for older browsers?
- Responding to the onmousemove event outside of the browser window in IE
- IE Bug (window === top) === false
- IE support for DOM importNode
- OnChange not firing in IE