Easy to use PHP & JS classes to allow a website to easily detect useful information about the client.

The 'Detect' PHP class expands the open-source Mobile Detect class from mobiledetect.net, plus added functions to increase the detected information.

The 'detect' JS class features functions unable to be used within PHP as the information can only be retrieved from the client.

publicIP Address54.80.137.168
languageHost Nameec2-54-80-137-168.compute-1.amazonaws.com
businessOrganisationAS14618 Amazon.com, Inc.
settings_overscanScreen Size
aspect_ratioViewport Size
computerDevice TypeComputer
Operating SystemUnknown OS
BrowserUnknown Browser

PHP Class

Simply include or require the class file & use. No need to instantiate the class as all methods are static:

// Include or require the class file.
require_once 'path_to/detect.php';

// Any mobile device (phones or tablets).
if (Detect::isMobile()) {


// Gets the device type ('Computer', 'Phone' or 'Tablet').
echo Detect::deviceType();

// Any phone device
if (Detect::isPhone()) {


// Any tablet device.
if (Detect::isTablet()) {


// Any computer device (desktops or laptops).
if (Detect::isComputer()) {


// Get the IP address of the device.
echo Detect::ip();

// Get the ID address host name of the device.
echo Detect::ipHostname();

// Get the IP address organisation of the device.
echo Detect::ipOrg();

// Get the country the IP address is in (IP address location inaccurate).
// (JS function available which uses GPS)
echo Detect::ipCountry();

// Get the name & version of operating system.
echo Detect::os();

// Get the name & version of browser.
echo Detect::browser();

// Get the brand of device (only works with mobile devices otherwise return null).
echo Detect::brand();

// Check for a specific platform with the help of the magic methods:
if (Detect::isiOS()) {


if (Detect::isAndroidOS()) {


All methods within the Mobile Detect class from mobiledetect.net are static & available.


JS Class

Include the JS file:

    <script type="text/javascript" src="path_to/detect.js"></script>

Only methods which require direct access to the local client to get information are available in JavaScript:

// Get screen width in pixels.

// Get screen height in pixels.

// Get viewport (browser window minus any toolbars etc) width in pixels.

// Get viewport (browser window minus any toolbars etc) height in pixels.

// Get latitude from GPS & update html conent of ID element passed.
// Null, if GPS unavailable.

// Get longitude from GPS & update html conent of ID element passed.
// Null, if GPS unavailable.

// Get address from GPS & update html conent of ID element passed.
// Null, if GPS unavailable.