Posted in

Detectar el dispositivo del usuario

Saber si un usuario accede desde un dispositivo móvil o incluso desde una tablet o un determinado sistema operativo movil.

Inicialización

require_once 'Mobile_Detect.php';
$detect = new Mobile_Detect;

Ejemplo de uso

// Basic detection.
$detect->isMobile();
$detect->isTablet();

// Magic methods.
$detect->isIphone();
$detect->isSamsung();
// [...]

// Alternative to magic methods.
$detect->is('iphone');

// Find the version of component.
$detect->version('Android');

// Additional match method.
$detect->match('regex.*here');

// Browser grade method.
$detect->mobileGrade();

// Batch methods.
$detect->setUserAgent($userAgent);
$detect->setHttpHeaders($httpHeaders);

Mobile-Detect-master

Deixa un comentari

L'adreça electrònica no es publicarà. Els camps necessaris estan marcats amb *


The reCAPTCHA verification period has expired. Please reload the page.