Well, that's clear and concise!  Even your stripped version is huge
compared to just looking for "iPhone".  Can you tell us what the
browser sig will be for the touch?  Seems like if we just search for
iPod or iPhone we should be OK, no?  At least until there are a
plethora of different ones, or perhaps a desktop iPod...

On Sep 7, 9:56 am, Richard Herrera <[EMAIL PROTECTED]> wrote:
> A number of iPhone apps are using JS to sniff iPhone and serve content
> based on that. While I haven't seen the user agent string for the
> upcomingTouch, chances are likely it will not contain
> indexOf('iPhone'). This means it only takes one viewing for that 
> newiPodTouchuser to declare that your app suxxors, et al.
>
> Webkit.org has released a very nice detection script that is
> compatible with both 
> devices:http://webkit.org/blog/119/webkit-detect-script-updated-for-iphone-an...
>
> But me being the ever-perfectionist iPhone developer, I've stripped
> out what's not needed if all you need is i(Phone ||Touch) detection:
>
> var WebKitDetect = {
>         isWebKit : function() {
>                 return new RegExp(" AppleWebKit/").test(navigator.userAgent);
>         },
>         isMobile : function() {
>                 return WebKitDetect.isWebKit() && new RegExp("
> Mobile/").test(navigator.userAgent);
>         },
>         mobileDevice : function() {
>                 if (!WebKitDetect.isMobile()) {
>                         return null;
>                 }
>                 var fields = new RegExp("(Mozilla/5.0 \\()([^;]
> +)").exec(navigator.userAgent);
>                 if (!fields || fields.length < 3) {
>                         return null;
>                 }
>                 return fields[2];
>         }
>
> };
>
> Usage:
>
> if (WebKitDetect.mobileDevice()) {
>         setInterval(updateLayout, 400);
>
> }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"iPhoneWebDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/iphonewebdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to