Skip to content

Instantly share code, notes, and snippets.

@makbeta
Created October 14, 2013 22:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save makbeta/6983057 to your computer and use it in GitHub Desktop.
Save makbeta/6983057 to your computer and use it in GitHub Desktop.
Setting isMobile session variable for Luminate Online
<!-- Copyright 2010 Convio, Inc. -->
<!--
Conditional for detecting mobile devices
[[?xx::x[[S80:isMobile]]x::
isMobile is not yet set
[[?xx::x[[S80:UserAgentLowerCase]]x::
UserAgentLowerCase is not yet set
Convert User-Agent from HTTP request header to lower case
[[U0:UserAgentLowerCase=[[E130:"[[S50:User-Agent]]" "A" "a" replaceall "B" "b" replaceall "C" "c" replaceall "D" "d" replaceall "E" "e" replaceall "F" "f" replaceall "G" "g" replaceall "H" "h" replaceall "I" "i" replaceall "J" "j" replaceall "K" "k" replaceall "L" "l" replaceall "M" "m" replaceall "N" "n" replaceall "O" "o" replaceall "P" "p" replaceall "Q" "q" replaceall "R" "r" replaceall "S" "s" replaceall "T" "t" replaceall "U" "u" replaceall "V" "v" replaceall "W" "w" replaceall "X" "x" replaceall "Y" "y" replaceall "Z" "z" replaceall]]]]
::
]]
Test for mobile device User-Agents
The string "CONVIO" is used as a prefix when testing for UAs that begin with a given value, like ^ in a regex
[[?
[[?[[S80:UserAgentLowerCase]]::176x220::T::]]
[[?[[S80:UserAgentLowerCase]]::240x320::T::]]
[[?[[S80:UserAgentLowerCase]]::320x320::T::]]
[[?[[S80:UserAgentLowerCase]]::alcatel::T::]]
[[?[[S80:UserAgentLowerCase]]::amoi::T::]]
[[?[[S80:UserAgentLowerCase]]::android::T::]]
[[?CONVIO[[S80:UserAgentLowerCase]]::CONVIObenq::T::]]
[[?CONVIO[[S80:UserAgentLowerCase]]::CONVIObird::T::]]
[[?[[S80:UserAgentLowerCase]]::blackberry::T::]]
[[?[[S80:UserAgentLowerCase]]::blazer::T::]]
[[?[[S80:UserAgentLowerCase]]::bunjalloo::T::]]
[[?[[S80:UserAgentLowerCase]]::coolpad::T::]]
[[?[[S80:UserAgentLowerCase]]::docomo::T::]]
[[?[[S80:UserAgentLowerCase]]::dopod::T::]]
[[?[[S80:UserAgentLowerCase]]::foma::T::]]
[[?[[S80:UserAgentLowerCase]]::ericsson::T::]]
[[?[[S80:UserAgentLowerCase]]::gionee::T::]]
[[?[[S80:UserAgentLowerCase]]::haier::T::]]
[[?[[S80:UserAgentLowerCase]]::helio::T::]]
[[?[[S80:UserAgentLowerCase]]::hiptop::T::]]
[[?[[S80:UserAgentLowerCase]]::hosin::T::]]
[[?[[S80:UserAgentLowerCase]]::htc::T::]]
[[?[[S80:UserAgentLowerCase]]::huawei::T::]]
[[?[[S80:UserAgentLowerCase]]::iemobile::T::]]
[[?[[S80:UserAgentLowerCase]]::iphone::T::]]
[[?[[S80:UserAgentLowerCase]]::jig browser::T::]]
[[?[[S80:UserAgentLowerCase]]::kddi::T::]]
[[?[[S80:UserAgentLowerCase]]::ktouch::T::]]
[[?CONVIO[[S80:UserAgentLowerCase]]::CONVIOlct::T::]]
[[?CONVIO[[S80:UserAgentLowerCase]]::CONVIOlge::T::]]
[[?[[S80:UserAgentLowerCase]]::longcos::T::]]
[[?[[S80:UserAgentLowerCase]]::maui::T::]]
[[?[[S80:UserAgentLowerCase]]::midp::T::]]
[[?CONVIO[[S80:UserAgentLowerCase]]::CONVIOmot-::T::]]
[[?[[S80:UserAgentLowerCase]]::motorola::T::]]
[[?[[S80:UserAgentLowerCase]]::netfront::T::]]
[[?[[S80:UserAgentLowerCase]]::nexian::T::]]
[[?[[S80:UserAgentLowerCase]]::nokia::T::]]
[[?[[S80:UserAgentLowerCase]]::novarra::T::]]
[[?[[S80:UserAgentLowerCase]]::opera mini::T::]]
[[?[[S80:UserAgentLowerCase]]::opera mobi::T::]]
[[?[[S80:UserAgentLowerCase]]::palmsource::T::]]
[[?[[S80:UserAgentLowerCase]]::pantech::T::]]
[[?[[S80:UserAgentLowerCase]]::philips::T::]]
[[?[[S80:UserAgentLowerCase]]::phone::T::]]
[[?[[S80:UserAgentLowerCase]]::portalmmm::T::]]
[[?[[S80:UserAgentLowerCase]]::sagem::T::]]
[[?CONVIO[[S80:UserAgentLowerCase]]::CONVIOsam-::T::]]
[[?[[S80:UserAgentLowerCase]]::samsung::T::]]
[[?[[S80:UserAgentLowerCase]]::sch-::T::]]
[[?[[S80:UserAgentLowerCase]]::sgh-::T::]]
[[?CONVIO[[S80:UserAgentLowerCase]]::CONVIOsie-::T::]]
[[?[[S80:UserAgentLowerCase]]::smartphone::T::]]
[[?[[S80:UserAgentLowerCase]]::softbank::T::]]
[[?CONVIO[[S80:UserAgentLowerCase]]::CONVIOspice::T::]]
[[?[[S80:UserAgentLowerCase]]::symbian::T::]]
[[?[[S80:UserAgentLowerCase]]::techfaith::T::]]
[[?CONVIO[[S80:UserAgentLowerCase]]::CONVIOucweb::T::]]
[[?[[S80:UserAgentLowerCase]]::up.browser::T::]]
[[?[[S80:UserAgentLowerCase]]::up.link::T::]]
[[?[[S80:UserAgentLowerCase]]::wap::T::]]
[[?[[S80:UserAgentLowerCase]]::webos::T::]]
[[?[[S80:UserAgentLowerCase]]::wellcom::T::]]
[[?[[S80:UserAgentLowerCase]]::windows ce::T::]]
[[?CONVIO[[S80:UserAgentLowerCase]]::CONVIOzte-::T::]]
::T::
[[U0:isMobile=1]]
::
Test for presence of x-wap-profile and/or Profile HTTP request headers
If either has a value, this is a mobile device
This is important for mobile devices that run something other than their native browser
For example, Firefox on a Blackberry sends the Firefox UA string with nothing to set it aside from Firefox on a PC
[[?
[[?xx::x[[S50:X-WAP-PROFILE]]x::::T]]
[[?xx::x[[S50:PROFILE]]x::::T]]
::T::
[[U0:isMobile=1]]
::
[[U0:isMobile=0]]
]]]]
::
isMobile session variable is set to [[S80:isMobile]]
]]
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment