About ismobiledevice?

Created on 21 May 2017, over 7 years ago
Updated 1 March 2024, 11 months ago

Any body can help out?

I use browscap API as below:

$mobile_agent = \Drupal::service('browscap')->getBrowser();
$vars['var_is_mobile']=$mobile_agent;

when I dump(var_is_mobile) , the ismobiledevice always be 0, why?

when view in Desktop, dump result:

 array(15) {
  ["comment"]=>
  string(15) "Default Browser"
  ["browser"]=>
  string(15) "Default Browser"
  ["browser_maker"]=>
  string(7) "unknown"
  ["version"]=>
  string(3) "0.0"
  ["majorver"]=>
  string(1) "0"
  ["minorver"]=>
  string(1) "0"
  ["platform"]=>
  string(7) "unknown"
  ["ismobiledevice"]=>
  string(1) "0"
  ["istablet"]=>
  string(1) "0"
  ["crawler"]=>
  string(1) "0"
  ["device_type"]=>
  string(7) "unknown"
  ["device_pointing_method"]=>
  string(7) "unknown"
  ["parent"]=>
  string(17) "DefaultProperties"
  ["useragent"]=>
  string(121) "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36"
  ["browser_name_pattern"]=>
  string(1) "*"
}

when view in iphone, dump result:



 array(15) {
  ["comment"]=>
  string(15) "Default Browser"
  ["browser"]=>
  string(15) "Default Browser"
  ["browser_maker"]=>
  string(7) "unknown"
  ["version"]=>
  string(3) "0.0"
  ["majorver"]=>
  string(1) "0"
  ["minorver"]=>
  string(1) "0"
  ["platform"]=>
  string(7) "unknown"
  ["ismobiledevice"]=>
  string(1) "0"
  ["istablet"]=>
  string(1) "0"
  ["crawler"]=>
  string(1) "0"
  ["device_type"]=>
  string(7) "unknown"
  ["device_pointing_method"]=>
  string(7) "unknown"
  ["parent"]=>
  string(17) "DefaultProperties"
  ["useragent"]=>
  string(133) "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1"
  ["browser_name_pattern"]=>
  string(1) "*"
}

πŸ’¬ Support request
Status

Closed: duplicate

Component

Code

Created by

πŸ‡¨πŸ‡³China hellobank

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024