Function Generator

help

How to get this thing working!

Use form below to select how you wish to handle mobile browsers you've detected, you can send them to a mobile site, to an app store or have the function return true or false giving your scripts control.

help

Grab yourself a Coke, this won't take you long

If you're fairly confident with PHP you should have this up and running in a few minutes, you just need to include a file and call a function which this form will help you build with a few clicks.

 

Detect Apple iPads

 

Detect Google Android Devices

 

Detect Opera Browsers

 

Detect BlackBerry Devices

 

Detect Palm Mobiles

 

Detect Windows Mobile Devices

 

Redirect Mobile Browsers

 

Redirect Desktop Browsers

 

Download

Usage Guide:

It should be as simple as a cut and paste but you need to understand at least basic PHP to get it working.

You need to include the file with the function then call the function before your PHP pages do anything else.

require_once('mobile_device_detect.php');
$mobile = mobile_device_detect();

The function has a number of parameters that can be passed to it which define the way it handles different scenarios. These paramaters are:

    • Apple iPhones
    • Apple iPhones
    • Set to true to treat iPhones as mobiles, false to treat them like full browsers or set a URL (including http://) to redirect iPhones and iPods to.
    • Apple iPads
    • Apple iPads
    • Set to true to treat iPads as mobiles, false to treat them like full browsers or set a URL (including http://) to redirect iPads to.
    • Google Android Mobiles
    • Google Android Mobiles
    • Set to true to treat Android handsets as mobiles, false to treat them like full browsers or set a URL (including http://) to redirect Google Android users to.
    • Opera Mobile Browser
    • Opera Mobile Browser
    • Set to true to treat Opera Mini like a mobile, false to treat it like full browser or set a URL (including http://) to redirect Opera users to.
    • BlackBerry / RIM Devices
    • BlackBerry / RIM Devices
    • Set to true to treat Blackberry like a mobile, false to treat it like full browser or set a URL (including http://) to redirect Blackberry's to.
    • Palm Mobiles
    • Palm Mobiles
    • Set to true to treat Palm OS like a mobile, false to treat it like full browser or set a URL (including http://) to redirect Palm OS's to.
    • Windows Mobiles
    • Windows Mobiles
    • Set to true to treat Windows Mobiles like a mobile, false to treat it like full browser or set a URL (including http://) to redirect Windows Mobile users to.
  • Mobile Redirect URL - This should be full web address (including http://) of the site (or page) you want to send mobile visitors to. Leaving this blank will make the script return true when it detects a mobile.

  • Desktop Redirect URL - This should be full web address (including http://) of the site (or page) you want to send non-mobile visitors to. Leaving this blank will make the script return false when it fails to detect a mobile.