Luminate: is mobile device viewing the page


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <!-- Copyright 2010 Convio, Inc. -->
  2.  
  3. <!--
  4. Conditional for detecting mobile devices
  5. [[?xx::x[[S80:isMobile]]x::
  6. isMobile is not yet set
  7. [[?xx::x[[S80:UserAgentLowerCase]]x::
  8. UserAgentLowerCase is not yet set
  9. Convert User-Agent from HTTP request header to lower case
  10. [[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]]]]
  11. ::
  12. ]]
  13. Test for mobile device User-Agents
  14. The string "CONVIO" is used as a prefix when testing for UAs that begin with a given value, like ^ in a regex
  15. [[?
  16. [[?[[S80:UserAgentLowerCase]]::176x220::T::]]
  17. [[?[[S80:UserAgentLowerCase]]::240x320::T::]]
  18. [[?[[S80:UserAgentLowerCase]]::320x320::T::]]
  19. [[?[[S80:UserAgentLowerCase]]::alcatel::T::]]
  20. [[?[[S80:UserAgentLowerCase]]::amoi::T::]]
  21. [[?[[S80:UserAgentLowerCase]]::android::T::]]
  22. [[?CONVIO[[S80:UserAgentLowerCase]]::CONVIObenq::T::]]
  23. [[?CONVIO[[S80:UserAgentLowerCase]]::CONVIObird::T::]]
  24. [[?[[S80:UserAgentLowerCase]]::blackberry::T::]]
  25. [[?[[S80:UserAgentLowerCase]]::blazer::T::]]
  26. [[?[[S80:UserAgentLowerCase]]::bunjalloo::T::]]
  27. [[?[[S80:UserAgentLowerCase]]::coolpad::T::]]
  28. [[?[[S80:UserAgentLowerCase]]::docomo::T::]]
  29. [[?[[S80:UserAgentLowerCase]]::dopod::T::]]
  30. [[?[[S80:UserAgentLowerCase]]::foma::T::]]
  31. [[?[[S80:UserAgentLowerCase]]::ericsson::T::]]
  32. [[?[[S80:UserAgentLowerCase]]::gionee::T::]]
  33. [[?[[S80:UserAgentLowerCase]]::haier::T::]]
  34. [[?[[S80:UserAgentLowerCase]]::helio::T::]]
  35. [[?[[S80:UserAgentLowerCase]]::hiptop::T::]]
  36. [[?[[S80:UserAgentLowerCase]]::hosin::T::]]
  37. [[?[[S80:UserAgentLowerCase]]::htc::T::]]
  38. [[?[[S80:UserAgentLowerCase]]::huawei::T::]]
  39. [[?[[S80:UserAgentLowerCase]]::iemobile::T::]]
  40. [[?[[S80:UserAgentLowerCase]]::iphone::T::]]
  41. [[?[[S80:UserAgentLowerCase]]::jig browser::T::]]
  42. [[?[[S80:UserAgentLowerCase]]::kddi::T::]]
  43. [[?[[S80:UserAgentLowerCase]]::ktouch::T::]]
  44. [[?CONVIO[[S80:UserAgentLowerCase]]::CONVIOlct::T::]]
  45. [[?CONVIO[[S80:UserAgentLowerCase]]::CONVIOlge::T::]]
  46. [[?[[S80:UserAgentLowerCase]]::longcos::T::]]
  47. [[?[[S80:UserAgentLowerCase]]::maui::T::]]
  48. [[?[[S80:UserAgentLowerCase]]::midp::T::]]
  49. [[?CONVIO[[S80:UserAgentLowerCase]]::CONVIOmot-::T::]]
  50. [[?[[S80:UserAgentLowerCase]]::motorola::T::]]
  51. [[?[[S80:UserAgentLowerCase]]::netfront::T::]]
  52. [[?[[S80:UserAgentLowerCase]]::nexian::T::]]
  53. [[?[[S80:UserAgentLowerCase]]::nokia::T::]]
  54. [[?[[S80:UserAgentLowerCase]]::novarra::T::]]
  55. [[?[[S80:UserAgentLowerCase]]::opera mini::T::]]
  56. [[?[[S80:UserAgentLowerCase]]::opera mobi::T::]]
  57. [[?[[S80:UserAgentLowerCase]]::palmsource::T::]]
  58. [[?[[S80:UserAgentLowerCase]]::pantech::T::]]
  59. [[?[[S80:UserAgentLowerCase]]::philips::T::]]
  60. [[?[[S80:UserAgentLowerCase]]::phone::T::]]
  61. [[?[[S80:UserAgentLowerCase]]::portalmmm::T::]]
  62. [[?[[S80:UserAgentLowerCase]]::sagem::T::]]
  63. [[?CONVIO[[S80:UserAgentLowerCase]]::CONVIOsam-::T::]]
  64. [[?[[S80:UserAgentLowerCase]]::samsung::T::]]
  65. [[?[[S80:UserAgentLowerCase]]::sch-::T::]]
  66. [[?[[S80:UserAgentLowerCase]]::sgh-::T::]]
  67. [[?CONVIO[[S80:UserAgentLowerCase]]::CONVIOsie-::T::]]
  68. [[?[[S80:UserAgentLowerCase]]::smartphone::T::]]
  69. [[?[[S80:UserAgentLowerCase]]::softbank::T::]]
  70. [[?CONVIO[[S80:UserAgentLowerCase]]::CONVIOspice::T::]]
  71. [[?[[S80:UserAgentLowerCase]]::symbian::T::]]
  72. [[?[[S80:UserAgentLowerCase]]::techfaith::T::]]
  73. [[?CONVIO[[S80:UserAgentLowerCase]]::CONVIOucweb::T::]]
  74. [[?[[S80:UserAgentLowerCase]]::up.browser::T::]]
  75. [[?[[S80:UserAgentLowerCase]]::up.link::T::]]
  76. [[?[[S80:UserAgentLowerCase]]::wap::T::]]
  77. [[?[[S80:UserAgentLowerCase]]::webos::T::]]
  78. [[?[[S80:UserAgentLowerCase]]::wellcom::T::]]
  79. [[?[[S80:UserAgentLowerCase]]::windows ce::T::]]
  80. [[?CONVIO[[S80:UserAgentLowerCase]]::CONVIOzte-::T::]]
  81. ::T::
  82. [[U0:isMobile=1]]
  83. ::
  84. Test for presence of x-wap-profile and/or Profile HTTP request headers
  85. If either has a value, this is a mobile device
  86. This is important for mobile devices that run something other than their native browser
  87. For example, Firefox on a Blackberry sends the Firefox UA string with nothing to set it aside from Firefox on a PC
  88. [[?
  89. [[?xx::x[[S50:X-WAP-PROFILE]]x::::T]]
  90. [[?xx::x[[S50:PROFILE]]x::::T]]
  91. ::T::
  92. [[U0:isMobile=1]]
  93. ::
  94. [[U0:isMobile=0]]
  95. ]]]]
  96. ::
  97. isMobile session variable is set to [[S80:isMobile]]
  98. ]]
  99. -->
  100.  

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.