# Different view for desktop and mobile browser

**URL:** <https://www.ruby-forum.com/t/different-view-for-desktop-and-mobile-browser/127231>\
**Category:** Rails\
**Created:** [January 26, 2008, 6:17pm UTC](https://www.ruby-forum.com/t/different-view-for-desktop-and-mobile-browser/127231 "2008-01-26T18:17:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pph](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/77aa72/32.png) [@pph](https://www.ruby-forum.com/u/pph)\
**Post date:** [January 26, 2008, 6:17pm UTC](https://www.ruby-forum.com/t/different-view-for-desktop-and-mobile-browser/127231/1 "2008-01-26T18:17:32Z")

</div>

Hi,  
I am just beginning with RoR and I need to add into existing RoR  
application version for mobile device-concretely iPhone. I need to  
change layer for it and a lot of view because I need different display  
on the iPhone. So I am thinking about three ways how to do it:

1. change a url address to domain/iphone/…  
-here i suppose i need to change routes for each of my new sites,  
probably new controllers etc. (i don’t know exacly) - this way seems to  
me like creating almost whole application again

2. add an attribute to the url like type=iphone and in controllers if is  
this type iphone render view for iphone

3. use session with same result like in point 2

Or is here some better way how to do it???  
Thank you very much for every help.  
Pavel

---

<div class="post-metadata">

**Author:** ![pph](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/77aa72/32.png) [@pph](https://www.ruby-forum.com/u/pph)\
**Post date:** [January 26, 2008, 6:47pm UTC](https://www.ruby-forum.com/t/different-view-for-desktop-and-mobile-browser/127231/2 "2008-01-26T18:47:26Z")

</div>

I would say no to all of those options.

Look here for a better way:  
[http://www.slashdotdash.net/articles/2007/12/04/iphone-on-rails-creating-an-iphone-optimised-version-of-your-rails-site-using-iui-and-rails-2](http://www.slashdotdash.net/articles/2007/12/04/iphone-on-rails-creating-an-iphone-optimised-version-of-your-rails-site-using-iui-and-rails-2)

On Jan 26, 12:17 pm, Pavel H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![pph](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/77aa72/32.png) [@pph](https://www.ruby-forum.com/u/pph)\
**Post date:** [January 26, 2008, 8:40pm UTC](https://www.ruby-forum.com/t/different-view-for-desktop-and-mobile-browser/127231/3 "2008-01-26T20:40:10Z")

</div>

brewpoo wrote:

> I would say no to all of those options.
> 
> Look here for a better way:  
> [http://www.slashdotdash.net/articles/2007/12/04/iphone-on-rails-creating-an-iphone-optimised-version-of-your-rails-site-using-iui-and-rails-2](http://www.slashdotdash.net/articles/2007/12/04/iphone-on-rails-creating-an-iphone-optimised-version-of-your-rails-site-using-iui-and-rails-2)
> 
> On Jan 26, 12:17 pm, Pavel H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

It looks good, thank you

---

<div class="post-metadata">

**Author:** ![pph](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/77aa72/32.png) [@pph](https://www.ruby-forum.com/u/pph)\
**Post date:** [January 27, 2008, 3:10pm UTC](https://www.ruby-forum.com/t/different-view-for-desktop-and-mobile-browser/127231/4 "2008-01-27T15:10:35Z")

</div>

Apple’s iPhone dev page.

> **[iOS 17 - Apple Developer](https://developer.apple.com/ios/)**
>
> iOS is the world’s most advanced mobile operating system. Learn about the latest APIs and capabilities that you can use to deliver incredible apps.

I have a site that has an iPhone layout but I just add a style on top  
of what I already developed. But I wanted the site to be mobile  
friendly from the start. On the ‘PC’ it’s very sparse.  
(self promotion)  
[http://www.cpord.com/](http://www.cpord.com/)  
[http://www.cpord.com/signup](http://www.cpord.com/signup)  
It’s in alpha. It’s another GTD(to-do list) app.  
It’s not flashy and chopped full of Ajax yet. I’ll be adding that  
later. Like I said, I’m aiming for mobile devices.  
(comments welcomed.)

i guess my point is you don’t really need to go to a subdomain for the  
iPhone, unless you want to send less data or diffeent functions to the  
iPhone.

my two cents. . .

John.

On Jan 26, 1:40 pm, Pavel H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
