Web and Mobile Web

This is a discussion on "Web and Mobile Web" within the PHP Forum section. This forum, and the thread "Web and Mobile Web are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jun 2nd, 2008, 05:54
New Member
Join Date: Jun 2008
Location: london
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Web and Mobile Web

Hi All, I am looking for a way of using handset detection to display the correct web view based on the device the consumer is visiting from. I have found handsetdetection.com but was wondering if anyone else knew of others i should compare it with. PHP friendly of course where ever possible...
Reply With Quote

  #2 (permalink)  
Old Jun 2nd, 2008, 08:44
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,953
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Re: Web and Mobile Web

Hi dave...

Its all going to be based on user-agent string comparison and detection....

All you really need is a list of user-agents that are mobile ones and then handle them accordingly.

try
PHP: Select all

$mobile=0;
$pda=0;
$ipod=0;


$pdabrowsers = array(
          
"Windows CE"
          
);
if(
preg_match('/('.implode('|'$pdabrowsers).')/i'$_SERVER['HTTP_USER_AGENT'], $match))
{
    
$pda=1;
}
else if (isset(
$_SERVER['HTTP_UA_OS']))
{
     if (
strstr($_SERVER['HTTP_UA_OS'],"POCKET PC") !== false)
    {
        
$pda=1;
    }
}

$ipodbrowsers = array(
          
"iPod",
          
"iPhone"
          
);
if(
preg_match('/('.implode('|'$ipodbrowsers).')/i'$_SERVER['HTTP_USER_AGENT'], $match))
{
    
$ipod=1;
}

if (
$pda == && $ipod ==0)
{
    
$mobilebrowsers = array(
        
"WebTV",
        
"AvantGo",
        
"Blazer",
        
"PalmOS",
        
"lynx",
        
"Go.Web",
        
"Elaine",
        
"ProxiNet",
        
"ChaiFarer",
        
"Digital Paths",
        
"UP.Browser",
        
"Mazingo",
        
"iPhone",
        
"iPod",
        
"Mobile",
        
"T68",
        
"Syncalot",
        
"Danger",
        
"Symbian",
        
"Symbian OS",
        
"SymbianOS",
        
"Maemo",
        
"Nokia",
        
"Xiino",
        
"AU-MIC",
        
"EPOC",
        
"Wireless",
        
"Handheld",
        
"Smartphone",
        
"SAMSUNG",
        
"J2ME",
        
"MIDP",
        
"MIDP-2.0",
        
"320x240",
        
"240x320",
        
"Blackberry8700",
        
"Opera Mini",
        
"NetFront",
        
"BlackBerry",
        
"PSP"
        
);
 
    if(
preg_match('/('.implode('|'$mobilebrowsers).')/i'$_SERVER['HTTP_USER_AGENT'], $match))
    {
        
$mobile=1;
    }
    elseif (
strpos($_SERVER['HTTP_ACCEPT'], 'application/vnd.wap.xhtml+xml'))
    {
        
$mobile=1;
    }
    elseif (
strpos($_SERVER['HTTP_ACCEPT'], 'text/vnd.wap.wml'))
    {
        
$mobile=1;
    }

It's not exactly tested, but should work with minor modifications
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Webforumz Mobile spinal007 Webforumz Cafe 5 Mar 21st, 2008 14:58
Looking for mobile / voip related links ricky Link Building and Link Sales 0 Jan 29th, 2008 09:05
Mobile Internet On Laptop Stormraven Webforumz Cafe 8 Nov 29th, 2007 09:40
planning a mobile web site Eran Website Planning 6 Nov 1st, 2007 13:33
Windows Mobile 5.0 Premium Simulator PixelLuv Web Page Design 4 Jul 21st, 2006 21:06


All times are GMT. The time now is 08:01.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43