I am using JavaScripts lastIndexOf()
which doesnt work in IE so I must write an alternative code.
I simply want an if statement to do something like:
if(IE = true){
//run alternative to lastIndexOf()
}
But I am really struggling with finding a way to achieve this.
So far I have tried the following:
JQuery's .browser
is deprecated.
.support
seems to only detect certain facets or features of a
browser.
Modifying .support
with JavaScript, as here, wont work and
throws errors.
The hasClass()
method no longer works:
<!--[if lt IE 7]> <html class="ie6"> <![endif]-->
<!--[if IE 7]> <html class="ie7"> <![endif]-->
<!--[if IE 8]> <html class="ie8"> <![endif]-->
<!--[if gt IE 8]><!--> <html> <!--<![endif]-->
if ($('html').hasClass('ie7');
Would anyone know a simple way to just detect the browser type?