Log in

View Full Version : Identifying Ipod or Ipad



SteveHeavy
02-01-2012, 06:26 PM
Is there a script available that I can put on a website to identify if it is being viewed on either Ipod or Ipad and if so immediately move to different page ?
Any help would be appreciated - I know you can identify Mac or PC but that idea didn't seem to work and Ipods/Ipads don't like Flash very much.

Thanks for your help

jscheuer1
02-01-2012, 07:30 PM
You are better off using just one page and serving your content in a way that any browser can render it. If you have Flash for instance, it's not the Flash you want the user to see, rather a video or a movie, perhaps you just want them to hear a sound. There are scripts for that. They will serve - say video, using the HTML 5 video tag to browsers like iPhone, while using Flash to show it to browsers like IE 7.

One such script is jPlayer:

http://www.jplayer.org/

But if you must detect iPhone/Pad/Pod, the browsers used by those devices all have userAgent strings that can be detected:


<script type="text/javascript">
if (/iphone|ipod|ipad/i.test(navigator.userAgent)) {
location.replace('someother.htm');
}
</script>

That code in the head of the page should take the iDevice user to a separate page, in this case - someother.htm

SteveHeavy
02-01-2012, 09:17 PM
Thanks John

Thats great