MX Mobile Device Detect documentation

TagsΒΆ

{exp:mobile_detect:device}

You have {exp:mobile_detect:device} !
{if "{exp:mobile_detect:device}" == "ipad"}

{/if}
{if "{exp:mobile_detect:device}" != "not_mobile"}
Greetings mobile visitor!
{/if}
{if "{exp:mobile_detect:device}" == "not_mobile"}

{/if}

Parameters

ignore_cookies

ignore_cookies = "yes"

refresh

refresh = "yes"

Refresh previous mobile detect result

{exp:mobile_detect:redirect}

{exp:mobile_detect:redirect location="http://m.site.com/"}
{exp:mobile_detect:redirect location="http://site.com/" redirect="not_mobile"}
{exp:mobile_detect:redirect ipad="http://ipad.site.com/" kindlefire="amazon.com"}

Parameters

location

URL for redirect

redirect default mobile

Two options:

redirect="mobile"
redirect="not_mobile"

client optional

the string which you want to find in HTTP_USER_AGENT. It could be the OS name/version, Browser name etc.. For example you can redirect all users with Internet Explorer 6.0 to specific page.

{exp:mobile_detect:redirect location="http://site.com/please-update-your-ie.html" client="MSIE 6."}

enable on / off

Turned off mobile redirection.

{exp:mobile_detect:redirect enable="off"  location="http://site.com/"}

cookie_name

cookie_value

cookie_name = "mobile_redirect"
cookie_value = "on"

This allows you to set a cookie on the mobile site to notify plugin that the mobile visitor should be allowed to view the full site.

custom_agents

*NOTE: Custom agents must be in low case. Replace spaces in name is replaced with underscores.

{exp:mobile_detect custom_agents="mobile/8a293"}
    {if device == "ipad"}
        Hello Steve
    {/if}
    {if device == "android" }
        Hello Bender
    {/if}
    {if device == "mobile/8a293" }
        Hello iPhone4
    {/if}
    {if not_mobile}
        Hello ...
    {/if}
{/exp:mobile_detect}

ignore_cookies

ignore_cookies = "yes"

refresh

refresh = "yes"

Refresh previous mobile detect result

Redirection/Condition for specific device

Redirection example

*NOTE: Device names must be in low case. Replace spaces in name is replaced with underscores.

{exp:mobile_detect:redirect location="http://site.com/" 
ipad="http://site.com/ipad/" android="http://site.com/android/"}

Disable redirection for specific device

{exp:mobile_detect location="http://site.com/" ipad="no"}

{exp:mobile_detect:pair}

*NOTE: Device names must be in low case. Replace spaces in name is replaced with underscores.

{exp:mobile_detect}
	{if device == "ipad"}
		Hello Steve
	{/if}
	{if device == "android" }
		Hello Bender
	{/if}
	{if not_mobile}
		Hello ...
	{/if}
{/exp:mobile_detect}

Parameters

ignore_cookies = "yes"

ignore_cookies = "yes"

Can be useful for menu

{exp:mobile_detect:pair ignore_cookies="yes"}
   {if mobile}      
      <a href="#" onClick="Set_Cookie( 'exp'+'_'+'mobile_redirect', 'off', '', '/', '', '','' );">Show desktop version</a>
   {/if}
   {if not_mobile}
      <a href="#" onClick="Set_Cookie( 'exp'+'_'+'mobile_redirect', 'on', '', '/', '', '','' );">Show mobile version</a>
   {/if}
{/exp:mobile_detect:pair}

refresh

refresh = "yes"

Refresh previous mobile detect result

Conditional variables

if mobile

{exp:mobile_detect}
 {if mobile}
 Is mobile device
 {/if}
{/exp:mobile_detect}

if not_mobile

{exp:mobile_detect:pair}
 {if not_mobile}
 Is not mobile device
 {/if}
{/exp:mobile_detect:pair}

{exp:mobile_detect:screen_detect }

{exp:mobile_detect:screen_detect }

this tag is put JS on the page to detect screen resolution at the first time when user visit you site. After that information will be available in global variables.

{if {screen_width} > 1024}You have desktop{/if}
{news_image}<img scr="/image/{screen_size}/{file_name}">{/news_image}

Settings

Mobile Detect Settings

Global Variables

{screen_width}

Screen Width

{screen_height}

Screen Height

{screen_pixel_ratio}

Pixel Ratio

{screen_size}

This Global Varible will consist

List of devices

android
blackberry
iphone4
iphone
ipad
kindlefire
opera
windows
palm
mobile

note: mobile condition is many mobile devices which ever existed