You are here

function variable_mobile_check_browser in Variable Extra 7

Check whether we are on a mobile device.

Bootstrap safe: Load browscap module if not loaded.

1 call to variable_mobile_check_browser()
variable_mobile_current_realm in variable_mobile/variable_mobile.module
Get current realm key for mobile variable.

File

variable_mobile/variable_mobile.module, line 50
Internationalization (i18n) package. Multilingual variables API.

Code

function variable_mobile_check_browser() {
  static $mobile;
  if (!isset($mobile)) {
    if (!function_exists('browscap_get_browser')) {
      drupal_load('module', 'browscap');
    }
    $browser = browscap_get_browser(NULL);
    $mobile = !empty($browser['ismobiledevice']);
  }
  return $mobile;
}