Tuesday, August 08, 2006

How to detect browsing with mobile phones/ PDA s

It took me one whole day but i guess I am somewhere there
A little help from here and there on google
but I am here to help the simple man a man like me

I got two ways to detect if your website is being opened on a desktop or a handheld device and you can accordingly direct your user to the particular website

1. The Resolution : Taking in mind everyone uses a minimum of 640*480 resolution otherwise its worthess making a website for them and PDA won't probably reach that resolution my first solution is

http://dayalaman.awardspace.com

CLICK HERE FOR SOURCE CODE


UPDATE

I
made the size check to x>=640 or y>=480

http://dayalaman.awardspace.com/34.htm

CLICK HERE TO DOWNLOAD SOURCE CODE




2. The Style Sheet Then I thought what if one day we get a 640 * 480 resolution hand held device, though that doesn't make sense to make, hey cumon if they have that big a device why will I make a handheld version for it ...thinking

anyways so i wasted another few hours using something, which seems a little less dogier than the above one, and we are sure that we are going on a handheld device

Style Sheet detect the media (eg screen, handheld etc) so we exploit that

http://dayalaman.awardspace.com/12.htm

CLICK HERE FOR SOURCE CODE

UPDATE

S
omehow this page doesn't open on the old IpAQ Pocket PC so i just put a header for redirection in case everything fails, u can redirect to a website where u can tell the user his javascript is disabled and what he would like to continue with full website or mobile if you want (problem is java script isnt disabled the old IPAQ just understands small amount of javascript and gets stuck where it doesn't) . U can delay the redirect time in the header if you want

http://dayalaman.awardspace.com/23.htm

CLICK HERE TO DOWNLOAD SOURCE CODE



I Guess Most of our Handheld devices support Javascript...i hope they do otherwise, if someone can code the above in PHP and publish it here (in the comments) it will be cool 2

THOUGH BOTH OF THE ABOVE SOLUTIONS WORK ON the IPAQ POCKETPC With Windows 2002 and the imate sp5


Next Blog would be how to make a mobile website, easily



0 Comments:

Post a Comment

<< Home