Browser Sniff

Developer

Laisvunas

3rd Party (Commercial)
Current Version: 2.4

3 downloads (last 90 days)

License Agreement

Buy Now!

$12.00
Qty:

EE Version Support

  • ExpressionEngine 2

Compatibility

If an item is crossed out, it might be untested, not applicable or incompatible. Contact the developer to be sure.

  • Updater
  • Multi Site Manager
  • Stand Alone Entry Form
  • Low Variables
  • Content Elements
  • Better Workflow
  • Matrix
  • Grid
  • Webservice
  • Publisher

Requirements

  • jQuery for the Control Panel

Add-On Type(s)

Plugin

Tags

Allows to get information about the browser, mobile device, or robot visiting your site.

PARAMETERS

1) available_languages - optional. Pipe delimited list of site’s languages. The value of this parameter
will be used to output the value of the variable “browser_sniff_negotiated_language”. E.g. available_languages=“fi|en” ,
“en” means English and “fi” means Finnish. The language code can be followed by a hyphen and then a two-character country code.
For example, “en-us” means American English and “en-gb” means British English. The first language code should indicate default language
of the website.

VARIABLES

1) browser_sniff_is_browser - outputs “yes” if the user agent is a known web browser and “no” otherwise.

2) browser_sniff_is_mobile - outputs “yes” if the user agent is a known mobile device and “no” otherwise.

3) browser_sniff_is_robot - outputs “yes” if the user agent is a known robot and “no” otherwise.

4) browser_sniff_is_referral - outputs “yes” if the user agent was referred from another site and “no” otherwise.

5) browser_sniff_browser - outputs a string containing the name of the web browser viewing your site.

6) browser_sniff_version - outputs a string containing the version number of the web browser viewing your site.

7) browser_sniff_mobile - outputs a string containing the name of the mobile device viewing your site.

8) browser_sniff_robot - outputs a string containing the name of the robot viewing your site.

9) browser_sniff_platform - outputs a string containing name of the platform viewing your site (Linux, Windows, OS X, etc.).

10) browser_sniff_platform_shortname - outputs a string containing short name of the platform viewing your site.
Possible values for this variable are: “Win”, “Mac”, “Linux” and “Other”.

11) browser_sniff_referrer - outputs referrer, if the user agent was referred from another site.

12) browser_sniff_agent_string - outputs a string containing the full user agent string.

To detect classes of mobile devices use the following variables. Use these variables to detect broad classes of mobile devices,
excluding the Apple iPad. However, for developing mobile-optimized web design, we recommend using the Device Tier variables.

13) browser_sniff_detect_smartphone - possible values “yes” and “no”. Detects any kind of smartphone device.
This variable doesn’t take into account browser capabilities.

14) browser_sniff_detect_mobilequick - possible values “yes” and “no”. Detects most recent mobile phones.

15) browser_sniff_detect_mobilelong - possible values “yes” and “no”. Detects most mobile phones,
including some older phones, and game consoles.

16) browser_sniff_detect_gameconsole - possible values “yes” and “no”. Detects all of the gaming consoles.

To detect groups of mobile devices based on capabilities of their browsers of their browsers use the
following variables.

17) browser_sniff_detect_tiertablet - possible values “yes” and “no”. These have larger screens
and their browsers are HTML 5-capable. These browsers handle CSS and JavaScript very well,
which means that modest AJAX sites with native (iPad or other) style components typically work great.
Includes: iPad, Android tablets (e.g., Xoom), BlackBerry PlayBook, WebOS, etc.

18) browser_sniff_detect_tieriphone - possible values “yes” and “no”. These are modern touchscreen phones.
These browsers handle CSS and JavaScript very well, which means that modest AJAX sites with native
(iPhone or other) style components typically work great.

19) browser_sniff_detect_tierrichcss - possible values “yes” and “no”. These devices can handle CSS
reasonable well, so that iPhone- or Android-style UIs generally look fine. Unfortunately, JavaScript
support is poor. For these reasons, in most cases, it’s probably best to serve these devices
the generic mobile site rather than the iPhone Tier site.

20) browser_sniff_detect_tierotherphones - possible values “yes” and “no”. Detects for all other mobile devices,
excluding the iPhone or Rich CSS tier devices. For these devices, it’s best to serve only the most basic CSS style,
limited to little more than text color, alignment, and bold/italics.

NOTICE: To best use the device tier detection, you might optimize your device detection logic like this (“fi” indicates site’s default language):

{exp:browser_sniff}

{if browser_sniff_detect_tiertablet == "yes"}

Some code for tablet optimized version of the site.

{if:elseif browser_sniff_detect_tieriphone == "yes"}

Some code for iPhone/Android/etc. optimized version of the site.

{if:elseif browser_sniff_detect_mobilequick == "yes"}

Some code for  the general mobile site with minimal CSS and no JavaScript.

{if:else}

Some code for modern desktop browser version of the site.

{/if}

{/exp:browser_sniff}

21) browser_sniff_negotiated_language - outputs the browser’s preferred language based on Accept-Language HTTP header.
For this variable to work the parameter “available_languages” must be defined. Also for this variable to work PHP
extension “pecl_http” available for free at http://pecl.php.net/package/pecl_http must be installed.

NOTICE. Use browser_sniff_negotiated_language variable as in this example (first laguage in pipe delimited list is default site�¢ï¿½ï¿½s language):


{exp:browser_sniff available_languages="fi|se|en"}

{if browser_sniff_negotiated_language == "se"}

here goes content for Swedish speakers

{if:elseif browser_sniff_negotiated_language == "en"}

here goes content for English speakers

{if:else}

here goes default content in Finnish

{/if}

{/exp:browser_sniff}

22) browser_sniff_detect_ipad - possible values “yes” and “no”. Detects iPad.

23) browser_sniff_detect_iphone - possible values “yes” and “no”. Detects iPhone.

Conditionals are supported for all variables.

USAGE EXAMPLE

{exp:browser_sniff}

Is browser?: {browser_sniff_is_browser}<br>

Is mobile?: {browser_sniff_is_mobile}<br>

Is robot?: {browser_sniff_is_robot}<br>

Is iPad?:  {browser_sniff_detect_ipad}
Is iPhone?: {browser_sniff_detect_iphone}
Is referral: {browser_sniff_is_referral}<br> Browser name: {browser_sniff_browser}<br> Browser version: {browser_sniff_version}<br> Mobile device name: {browser_sniff_mobile}<br> Robot name: {browser_sniff_robot}<br> Platform name: {browser_sniff_platform}<br> Platform shortname: {browser_sniff_platform_shortname}<br> Referrer: {browser_sniff_referrer}<br> User agent string: {browser_sniff_agent_string}<br> {/exp:browser_sniff}

This entry was created June 5, 2009, 1:34 pm.
This entry was last updated September 6, 2014, 3:20 pm.

Disclaimer: Information about ExpressionEngine add-ons is provided as a service to you, the user, and every member of the ExpressionEngine community. devot:ee is not responsible if you hose, mangle, wreck, or otherwise destroy your EE website by installing an add-on that you found out about at this site, regardless of its rating, Favorites status, commercial or free status, or general popularity. Caveat EEmptor!

Returns: devot:ee has a 30-day return policy on all commercial add-ons sold through devot-ee.com. If you need to return an add-on, do not go to the developer or the developer's site, but rather visit our returns page at https://devot-ee.com/returns to initiate your return. If you have questions, email support@devot-ee.com.

1 Review:

5BYFIVE 05.13.14

Rating - {addon_rating_average}

I used this to detect the browser language so I could redirect to a different language URL. Laisvunas updated the plugin so it would perform the detection without the “required” php module being installed on the server. Very helpful.