|
|
How can I auto-detect that someone's on an Apple iPad?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? 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! Looking for iPad help? Good news; you've found it!
More Useful Apple iPad Help Articles:
✔ Closed captioning for TV shows and movies on my iPhone?
Hey Dave, I saw your article from a few days about How to Turn on Closed Captioning in iTunes and am wondering if...
✔ Capture and email a portion of an iPad screen display?I would like to be able to clip out a rectangular section of any screen on the iPad (not just web pages) and...
✔ Review: Verticus for iPadiOS gamers everywhere are familiar with the genre of infinite forward progress apps - Mega Jump, Canabalt, and a host of other run/jump/fly-until-you-die...
✔ Enable Apple 2-Step Verification in iTunes?I keep reading all these articles about iTunes account security and people having their accounts hacked. I have 2-step security verification set up...
✔ The Best Free iOS Apps?Whether the best things in life are free is an issue hotly debated over. With iOS apps, this may or may not be...
Let's stay in touch!
Sign up for my weekly AskDaveTaylor Newsletter and you'll receive even more tech and gadget help
right to your inbox, along with exclusive news and industry updates. It's good stuff. I promise!
Categorized:
Apple iPad Help
,
HTML, JavaScript and Web Site Programming
(Article 9374,
Written by Dave Taylor)
Tagged: apple ipad, apple iphone, browser detection, google chrome, web programming Previous: How do I create an event for my Facebook group? Next: How do I copy Keynote presentations onto my Apple iPad? Reader Comments To Date: 3sam said, on June 1, 2010 1:39 AM:
I also need to redirect iphone users to a html version of the site since flash isn’t read by apple iphones! ansia said, on May 22, 2012 7:42 PM:
that s what i was looking for...! thanks
I do have a comment, now that you mention it!Check This Out Too... |
Recent Entries
Look for Answers
Recommended
All Our Categories
Apple iPad Help
Articles and Reviews Auctions and Online Shopping Blogs and Blogging Building Web Site Traffic Business and Management Computer and Internet Basics d) None of the Above Facebook Help Google Gmail Help Google Plus Help HTML, JavaScript and Web Site Programming Industry News and Trade Shows iPhone and Cell Phone Help iPod, Sony PSP and MP3 Player Help Kindle Fire Help Mac OS X Help Pay Per Click (PPC) Advertising Pinterest Help Search Engine Optimization (SEO) Shell Script Programming Tech Support Video Help The Writing Business Twitter, LinkedIn and Social Network Help Unix and Linux Help Video Game Tips and Help Windows PC Help Find Me on Google+ ADT on G+ |
Thanks for this post! Very useful.
I created a small tutorial that shows how to detect the ipad browser and redirect to an appropriate directory.
http://cardonadesigns.com/wordpress/2010/04/04/using-php-to-detect-the-ipad-user-agent/