En entregas anteriores vimos:
- Cómo detectar el sistema operativo Android con Javascript, PHP y .htaccess;
- Cómo detectar con Javascript, PHP y .htaccess al iPad y iPhone.
En esta entrega veremos cómo detectar también con Javascript, PHP y .htaccess dispositivos con Symbian, Windows Mobile, BlackBerry y Palm OS.
![]()
Detectar Symbian con Javascript
Con el siguiente código detectamos el dispositivo, el sistema operativo y si el navegador está basado en WebKit:
var deviceS60 = "series60";
var deviceSymbian = "symbian";
var engineWebKit = "webkit";
//Initializar la variable del agente de usuario
var uagent = navigator.userAgent.toLowerCase();
//**************************
// Detecta si el navegador es S60 Open Source
function DetectS60OssBrowser()
{
if (uagent.search(engineWebKit) > -1)
{
if ((uagent.search(deviceS60) > -1 ||
uagent.search(deviceSymbian) > -1))
return true;
else
return false;
}
else
return false;
}
Detectar Symbian con PHP
$devicesymbian = strtolower($_SERVER['HTTP_USER_AGENT']);
if(stripos($devicesymbian,'symbian') !== false)
{
// si es Symbian cargará la siguiente URL
header('Location: https://pixelcoblog.com/symbian/');
exit();
}
Detectar Windows Mobile con Javascript
var devicewindowsce = "windows ce";
var uagent = navigator.userAgent.toLowerCase();
function Detectwindowsce()
{
if (uagent.search(devicewindowsce) > -1)
return true;
else
return false;
}
Detectar Symbian con PHP
$devicewindowsce = strtolower($_SERVER['HTTP_USER_AGENT']);
if(stripos($devicewindowsce,'windows ce') !== false)
{
// si es Windows Mobile cargará la siguiente URL
header('Location: https://pixelcoblog.com/winmob/');
exit();
}
Detectar BlackBerry con Javascript
var devicebb = "blackberry";
var uagent = navigator.userAgent.toLowerCase();
function Detectibb()
{
if (uagent.search(devicebb) > -1)
return true;
else
return false;
}
Detectar BlackBerry con PHP
$devicebb = strtolower($_SERVER['HTTP_USER_AGENT']);
if(stripos($devicebb,'blackberry') !== false)
{
// si es BlackBerry cargará la siguiente URL
header('Location: https://pixelcoblog.com/bb/');
exit();
}
Detectar Palm OS con Javascript
var devicepalm = "palm";
var uagent = navigator.userAgent.toLowerCase();
function DetectiPalm()
{
if (uagent.search(deviceipalm) > -1)
return true;
else
return false;
}
Detectar Palm OS con PHP
$devicepalm = strtolower($_SERVER['HTTP_USER_AGENT']);
if(stripos($devicepalm,'palm') !== false)
{
// si es Palm cargará la siguiente URL
header('Location: https://pixelcoblog.com/palm/');
exit();
}
Detectar Symbian, Windows Mobile, BlackBerry y Palm OS con .htaccess
RewriteCond %{HTTP_USER_AGENT} ^.*symbian.*$
RewriteRule ^(.*)$ https://pixelcoblog.com/symbian [R=301]
RewriteCond %{HTTP_USER_AGENT} ^.*windows*ce.*$
RewriteRule ^(.*)$ https://pixelcoblog.com/windowsmob [R=301]
RewriteCond %{HTTP_USER_AGENT} ^.*blackberry.*$
RewriteRule ^(.*)$ https://pixelcoblog.com/bb [R=301]
RewriteCond %{HTTP_USER_AGENT} ^.*palm.*$
RewriteRule ^(.*)$ https://pixelcoblog.com/palm [R=301]
Nota de referencias
Los códigos fuentes que aparecen en este post, son variaciones de los código del post: Cómo detectar Android con Javascript, PHP o .htaccess y del post Detecting Smartphones Using JavaScript.
Comments are closed.