Browser detection
2% of Grails users
Dependency :
compile ":browser-detection:0.4.3"
Summary
This plugin provides service and tag library for browser detection. You can know what is the browser, version, operating system and language specified in request headers.
Installation
grails install-plugin browser-detection
Description
This plugin provides service and tag library for browser detection. You can know what is the browser, version and operating system specified in request headers.
The plugin is built on top of user-agent-utils libraryTo install:
And then add code to your gsp's:
You can use the following structure that emulates Or the following:At the moment wildcards are allowed only for
grails install-plugin browser-detection
<browser:isMsie>Internet Explorer</browser:isMsie><browser:isSafari></browser:isSafari><browser:isChrome></browser:isChrome><browser:isFirefox></browser:isFirefox><browser:isOpera></browser:isOpera><browser:isiPhone></browser:isiPhone><browser:isiPad></browser:isiPad><browser:isWindows></browser:isWindows><browser:isMobile>Mobile phones or Android, iPhone, iPad, iPod, Blackberry, etc.</browser:isMobile><browser:isOther>browser is undefined or user-agent header is not set</browser:isOther>
switch behavior:<browser:choice> <browser:isIE6></browser:isIE6> <browser:isIE7></browser:isIE7> <browser:otherwise></browser:otherwise></browser:choice>
<browser:isSafari versionGreater="5"> This text is rendered if Safari version is greater than 5. For example, 5.0.1, 5.1 </browser:isSafari><browser:isFirefox version="3.*"> It works for all Firefox versions like 3.1, 3.6 and so on </browser:isFirefox><browser:isMsie versionLower="7">Internet Explorer 5.0, Internet Explorer 6.0</browser:isMsie>
version attribute. Be aware that 5.1 is greater than 5 and 5.0 equals to 5.You can call methods isMsie, isSafari, isChrome and others with UserAgentIdentService service.You can send suggestions to vare6gin(et)gmail.com