Recent Articles

Using Standard Web Development To Decrease Mistakes
When I created my first websites, I have to admit that I was pretty naive about the graphic/visual side of things. SEO ROI is a good example. When I was creating...

Adding Site Caching To Your Wordpress Blog
The question for today's post comes from Meg Geddes aka NetMeg. She wants to know more about setting up caching on Wordpress. Ok, let's get the big question out of the way. What is caching and why do you...

Increasing Your Site Traffic By Enhancing Your Coding
Just because you have a site does not mean you are getting traffic. Your site could be as useful as the dust covered running shoes in your closet, you have...

Gaining A Large ROI On Your SEO
Let me give this analogy a try; It takes 100 pennies to make a dollar. If you are happy and content with having just 90 cents, then that's okay, but if you demand the full dollar, you can't ignore a few pennies just...

Adding A More Defined Search To Your Google Search Bar
I have a Google search box on my site, thanks to your article How to add Google Search to Your Site, but want to automatically add a few words to the search...


04.06.10

Auto-detecting An iPad Web Browser

By Dave Taylor

I'm working on my Web site and now that the Apple iPad is out, I'd like to customize my greeting for people using that device. How can I auto-detect that they're on an iPad?

Dave's Answer:

There are a ton of tools to help you with this particular task, and I've written about it before too (see How to detect an iPhone web browser). The basic idea is that every Web browser on every hardware platform sends what's called a USER_AGENT identifier. Almost all of the time they're accurate, but some test browsers have the ability to pretend they're something else (known in the biz as "spoofing", actually).

On my Mac OS X system, for example, when I am hitting Web pages within Google's Chrome browser, here's what is sent to the Web server
for each and every transaction I do, whether an HTML page, PHP search result or even ask for a photo or other image:

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.347.0 Safari/533.2

You can check your Web browser too. Just pop over to Microsystools and find out.

Now, the question of the moment is, what string does it show when you're on an Apple iPad?


Here's the answer:

Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version /4.0.4 Mobile/7B367 Safari/531.21.10

Pretty ugly, really, but the key thing to notice is that the first word within parens identifies the hardware platform. If you're writing code of some sort, simply grab the USER_AGENT string, then check that first word.

Oh, if you're on an iPhone and you go to the same page, here's the USER_AGENT you are sending on each query:

Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_3 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version /4.0 Mobile/7E18 Safari/528.16

Good luck!

Comments

About the Author:
Dave Taylor is known as an expert on both business and technology issues. Holder of an MSEd and MBA, author of twenty books and founder of four startups, he also runs a marketing company and consults with firms seeking the best approach to working with weblogs and social networks. Dave is an award-winning speaker and frequent guest on radio and podcast programs.

AskDaveTaylor.com
http://www.intuitive.com/blog/
About DevWebProNL
DevWebProNL is for professional developers ... those who build and manage applications and sophisticated websites. DevWebProNL delivers via news and expert advice New Strategies In Development.





DevWebProNL is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQLProNews.com
ITcertificationNews.com SysAdminNews.com
LinuxProNews.com WirelessProNews.com
CProgrammingTrends.com ITmanagementnews.com






-- DevWebProNL is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
© 2010 iEntry Inc. All Rights Reserved Privacy Policy Legal

archives | advertising info | news headlines | free newsletters | comments/feedback | submit article


Delivering IT Solutions DevWebPro DevWebPro Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact