What browser is the user running? (IE, Firefox, Chrome, Safari, ...) - El Toro - Find articles about Visualforce, Apex, Force.com and Salesforce in general

Print Preview

What browser is the user running? (IE, Firefox, Chrome, Safari, ...)

Using this line of code in apex:

ApexPages.currentPage().getHeaders().get('User-Agent')

you could get the full "User-Agent" information, but you will have to do some string manipulation to decide what browser it is.

I have done some searches in Google to help you understand the User-Agent String. This is a list of URLs I found:

http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx
http://whatsmyuseragent.com/
http://www.javamex.com/tutorials/servlets/headers_user_agent.shtml

comments powered by Disqus

© El Toro . IT @ 2013
Andrés Pérez