Plugins You can find out about all the publicly available Grails plugins.

Browser Detection Plugin

8 votes

3% of Grails users

compile "org.grails.plugins:browser-detection:2.9.0"

 Documentation  Source  Issues


This plugin helps you detect browsers, versions, language and operating systems from the request headers.


Add the dependency to the plugin in your BuildConfig.groovy. Remember to replace the "x.x.x" for the latest version.

compile ':browser-detection:x.x.x'

If you encounter a Maven repo dependency issue, try adding this line to the repositories section of your BuildConfig.groovy

mavenRepo ''


This plugin provides a service and tag library for browser detection. It parses User-Agent in order to identify client's browser, operating system, etc. It depends on user-agent-utils library from HaraldWalker.

If you want to contribute, report issues or just check the code. You can find it at GitHub.

Here are some of the things that you can currently do with this plugin. All this operations can be used from GSPs or you can use the UserAgentIdentService anywhere in your code.

Detecting Browsers

<browser:isMsie> This is Internet Explorer </browser:isMsie>
<browser:isSafari> This is Safari </browser:isSafari>
<browser:isChrome> This is Chrome </browser:isChrome>
<browser:isFirefox> This is Firefox </browser:isFirefox>
<browser:isOpera> This is Opera </browser:isOpera>

Detecting Devices

<browser:isiPhone> This is iPhone </browser:isiPhone>
<browser:isiPad> This is iPad </browser:isiPad>
<browser:isMobile>Mobile phones or Android, iPhone, iPad, iPod, Blackberry, etc.</browser:isMobile>

Detecting Operative Systems

<browser:isWindows> This is Windows </browser:isWindows>

Other operations

You can use the following structure that emulates switch behavior:


Or the one below:

<browser:isSafari versionGreater="5">
	This text is rendered if Safari version is greater than 5.
	For example, 5.0.1, 5.1
<browser:isFirefox version="3.*">
	It works for all Firefox versions like 3.1, 3.6 and so on
<browser:isMsie versionLower="7">
	Internet Explorer 5.0, Internet Explorer 6.0

At the moment, wildcards are allowed only for version attribute. Be aware that 5.1 is greater than 5 and 5.0 equals to 5.