ELAYARAJA
ELAYARAJA

Reputation: 521

IE 11 : How Can we Detect Browser Version IE 11 Using Java?

All of you know I.E 11 was Released.!! Before that to detect the Browser Version in Java, Using

"getHttpServletRequest().getHeader("User-Agent")".

It gives the the Browser name and Version. But After Introducing I.E 11 User Agent MSIE was removed..

So that how can we get the version for I.E in JAVA.

If any help it would help me a lot...

Thank You...

Upvotes: 5

Views: 6356

Answers (1)

eis
eis

Reputation: 53502

getHttpServletRequest().getHeader("User-Agent")

This should not throw nullpointerexception. Instead it should give the text

Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko 

for IE 11 in standards mode, and

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; Trident/7.0; .NET4.0E; .NET4.0C)

in compability view. You can match those if you want to. However, as mentioned in this article, user agent sniffing is not recommended.

Upvotes: 2

Related Questions