How to Detect If a Website Is Being Browsed Through a Mobile Device with PHP

Last Updated on Sunday, 20 May 2012 12:37 Written by Richi González Friday, 9 March 2012 12:00

Hello,

As technology is changing, and a great percentage of the total Internet users browse the web through their mobile devices, it’s become essential for a web developer, to add support for these devices. This can be achieved in various ways, but today, I’ll show you how to do it with PHP.

Difficulty level: Easy

1. Open up the header.php file of your website or the index.php file; if you just want to test it, simply create a new PHP file.

2. At the top, add the following:

Learn More

Search

Authors

Web Hosting

Linux Hosting
ASP .NET Hosting
Business Hosting
Reseller Hosting
E-Commerce Hosting
Dedicated Servers

Acceptable Use Policy
Terms of Service
Privacy Policy

Affiliate Program
Site Map

Blog Hosting

WordPress Hosting
ExpressionEngine Hosting
Movable Type Hosting
Habari Hosting
Textpattern Hosting


CMS Hosting

Joomla Hosting
Drupal Hosting
MODX Hosting
Concrete5 Hosting
Xoops Hosting
Shopping Cart Hosting

nopCommerce Hosting
OpenCart Hosting
Magento Hosting
osCommerce Hosting
Tomato Cart Hosting


Video Sharing Software Hosting

ClipBucket Hosting
ClipShare Hosting
osTube Hosting
vShare Hosting
MediaXXX Hosting
Forum Hosting

XenForo Hosting
vBulletin Hosting
MyBB Hosting
phpBB Hosting
Simple Machines Hosting


Social Network and Community Website Hosting

SocialEngine Hosting
Elgg Hosting
SkaDate Hosting
Dolphin Hosting
phpfox Hosting
Copyright © 2003-2013 Arvixe, LLC. All trademarks are property of their legal owner.