# Auto Detecting iPhone Web Browser

**URL:** <https://forum.kirupa.com/t/auto-detecting-iphone-web-browser/260464>\
**Category:** web dev\
**Created:** [May 15, 2008, 9:38pm UTC](https://forum.kirupa.com/t/auto-detecting-iphone-web-browser/260464 "2008-05-15T21:38:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jderosa3](https://avatars.discourse-cdn.com/v4/letter/j/3be4f8/32.png) [@jderosa3](https://forum.kirupa.com/u/jderosa3)\
**Post date:** [May 15, 2008, 9:38pm UTC](https://forum.kirupa.com/t/auto-detecting-iphone-web-browser/260464/1 "2008-05-15T21:38:53Z")

</div>

I want to make my website auto-detect if a person is using an iPhone to browse the site and if so it pulls from a different set of files to be displayed… any tips or tutorials on how to do this?

Thanks.

---

<div class="post-metadata">

**Author:** ![jkanakaraj](https://avatars.discourse-cdn.com/v4/letter/j/90db22/32.png) [@jkanakaraj](https://forum.kirupa.com/u/jkanakaraj)\
**Post date:** [May 16, 2008, 7:25am UTC](https://forum.kirupa.com/t/auto-detecting-iphone-web-browser/260464/2 "2008-05-16T07:25:52Z")

</div>

Try something like this…

```auto
var agent=navigator.userAgent.toLowerCase();
var is_iphone = ((agent.indexOf('iPhone')!=-1);
if (is_iphone) { conditional code goes here }

```

[QUOTE=jderosa3;2326870]I want to make my website auto-detect if a person is using an iPhone to browse the site and if so it pulls from a different set of files to be displayed… any tips or tutorials on how to do this?

Thanks.[/QUOTE]
