-2

To check if user is using IE should this work :

if( $.browser.msie)
alert('in IE');

Is this applicable to all versions of IE ?

blue-sky
  • 51,962
  • 152
  • 427
  • 752

2 Answers2

1

Is this applicable to all versions of IE ?

Yes, it is applicable to all versions of IE (I've just tested on ie7, ie8, ie9, which you should have)

Its not at all recommended, from the jQuery docs itself,

Because $.browser uses navigator.userAgent to determine the platform, it is vulnerable to spoofing by the user or misrepresentation by the browser itself. It is always best to avoid browser-specific code entirely where possible. The $.support property is available for detection of support for particular features rather than relying on $.browser.

Jashwant
  • 28,410
  • 16
  • 70
  • 105
0

Depends on which version of jQuery you're using, $.browser is deprecated. You should read the API fore more informations. Use $.support for test browser comptability.

jbrtrnd
  • 3,815
  • 5
  • 23
  • 41