Hello I want to detect the Browser , IE 8 or more will be appropriate for me. For this i used following code but it fails for IE 11 . For other its detecting properly.
Is better for you if you avoid browser detection; if you need it here is a good explain from MS team:
In rare cases, it may be necessary to uniquely identify IE11 Preview. Use the Trident
token to do so
For many legacy websites, some of the most visible updates for IE11 Preview involve the user-agent string. Here's what's reported for IE11 Preview on Windows 8.1 Preview: JavaScript
Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko
As with previous versions of Internet Explorer, portions of user-agent string vary according to the environment. Here's the string for IE11 Preview on Windows 7: JavaScript
Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko
If you compare these strings to the ones reported by earlier versions of Internet Explorer, you'll find the following changes: The compatible ("compatible") and browser ("MSIE") tokens have been removed. The "like Gecko" token has been added (for consistency with other browsers). The version of the browser is now reported by a new revision ("rv") token. These changes help prevent IE11 Preview from being (incorrectly) identified as an earlier version. In general, you should avoid detecting specific browsers or browser versions. The assumptions underlying such tests tend to lead to false positive results when browsers are updated. Instead, detect features as you need them and use progressive enhancement to provide simplified experiences for browsers or devices that do not support the features you need. In rare cases, it may be necessary to uniquely identify IE11 Preview. Use the Trident token to do so
Link: http://msdn.microsoft.com/en-us/library/ie/bg182625(v=vs.85).aspx