Detect if a mobile device is accessing your application

With a proliferation of mobile devices, web applications now need to be able to detect if it is being viewed on a mobile platform. The mobile detection library here can help you in these matters. Obviously I’ve not tested it on all available devices but it worked on a few I’ve got.Sample code and a quick demo are shown below.

<?php
 
require_once "ismobile.class.php";
 
$ismobile = new IsMobile();
 
if($ismobile->CheckMobile()) {
    echo 'Your mobile device is a ' . $ismobile->GetMobileDevice();
}
else {
    echo "It isn't a mobile device!";
}
 
?>

View the following link on your mobile device.

Besides the above functions it can also detect if WAP is being used on the mobile.

$iswap = $ismobile->checkMobileWap();

2 Responses

  1. Johny C says:

    I used Opera mobile browser on Nokia E5. & It displayed “This isn’t a mobile device” message.

  2. Dadan says:

    @Johny,
    Opera Mobile is different with opera mini
    Opera mobile have choice to choose user agent
    and default user agent opera mobile is Desktop