io uso questo:
Codice PHP:
$USERAG = $_SERVER['HTTP_USER_AGENT'];
$findme = 'iPhone';
$findme2 = 'iPad';
$findme3 = 'MMHttp';
$pos = strpos($USERAG, $findme);
$pos2 = strpos($USERAG, $findme2);
$pos3 = strpos($USERAG, $findme3);
// Note our use of ===. Simply == would not work as expected
// because the position of 'a' was the 0th (first) character.
if ($pos === false and $pos2 === false and $pos3 === false) {
include("header_flash.php");
} else {
include("header_ipad.php");
}
per caricare l'header flash o una immagine semplice.
Lo script cerca nella stringa $USERAG le parole nelle variabili $findme - 2 - 3..
se trova iphone o ipad (ATTENTO ALLE MAIUSCOLE..) allora carica un contenuto, altrimenti ne carica un altro..