# Rails site for mobile devices too

**URL:** <https://www.ruby-forum.com/t/rails-site-for-mobile-devices-too/153047>\
**Category:** Rails\
**Created:** [November 11, 2008, 2:59pm UTC](https://www.ruby-forum.com/t/rails-site-for-mobile-devices-too/153047 "2008-11-11T14:59:18Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ricardo\_Sazima](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a87d85/32.png) [@Ricardo\_Sazima](https://www.ruby-forum.com/u/Ricardo_Sazima)\
**Post date:** [November 11, 2008, 2:59pm UTC](https://www.ruby-forum.com/t/rails-site-for-mobile-devices-too/153047/1 "2008-11-11T14:59:18Z")

</div>

Guys,

Need help on how to serve pages for mobile devices. Can someone point  
out a  
couple of references to start? I’ve been reading some materials and  
already  
have a couple of questions:

1. Is WAP (WML) still needed or can we go directly to XHTML-MP? I mean  
do  
the majority of mobile browsers already understand XHTML-MP? What is  
it’s  
acceptance and spread?

2. Any generators for XHTML-MP views? Coding by hand is quite arduous…

3. How to handle login and sessions? I mean, does the mobile device  
sends  
it’s telephone number? Or any other unique identifier? Is it capable of  
accepting & storing cookies?

Thanks in advance for the help!

Cheers, Sazima

---

<div class="post-metadata">

**Author:** ![Ricardo\_Sazima](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a87d85/32.png) [@Ricardo\_Sazima](https://www.ruby-forum.com/u/Ricardo_Sazima)\
**Post date:** [November 11, 2008, 3:09pm UTC](https://www.ruby-forum.com/t/rails-site-for-mobile-devices-too/153047/2 "2008-11-11T15:09:52Z")

</div>

On 11 Nov 2008, at 13:58, Ricardo Sazima wrote:

> 1. Any generators for XHTML-MP views? Coding by hand is quite  
> arduous…

The mobile stuff I’ve done has been plain old xhtml mobile profile  
stuff. I’m sure there are old-skool wap phones still out there though.  
To an extent it depends on your target market, eg if you’re primary  
target is business people then making sure it works well on a  
blackberry is probably more important than worrying about wap

> 1. How to handle login and sessions? I mean, does the mobile device  
> sends it’s telephone number? Or any other unique identifier? Is it  
> capable of accepting & storing cookies?

Mobile devices tend to be a lot stricter as to how many cookies they  
will store and things like that. Phones do not send a unique id or  
their phone number, but companies like [http://bango.com/](http://bango.com/) have deals  
with the mobile network operators that allow them to identify people  
(last time I looked it thought everyone using opera mini was in norway  
(because opera mini proxies traffic through servers in norway) and had  
trouble with iphones.

Fred

---

<div class="post-metadata">

**Author:** ![Ricardo\_Sazima](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a87d85/32.png) [@Ricardo\_Sazima](https://www.ruby-forum.com/u/Ricardo_Sazima)\
**Post date:** [November 11, 2008, 5:33pm UTC](https://www.ruby-forum.com/t/rails-site-for-mobile-devices-too/153047/3 "2008-11-11T17:33:09Z")

</div>

Hi Fred,

The audience is the average Internet user. Any idea on what mobile  
browser capabilities to expect? Do you think WML is mandatory or can  
we stick to xHTML?

How did you generate xHTML views? Did you use any specific editor /  
IDE?

Finally, how do you differentiate between your users?

Cheers, Sazima

On Nov 11, 12:09 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Ricardo\_Sazima](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a87d85/32.png) [@Ricardo\_Sazima](https://www.ruby-forum.com/u/Ricardo_Sazima)\
**Post date:** [November 11, 2008, 5:41pm UTC](https://www.ruby-forum.com/t/rails-site-for-mobile-devices-too/153047/4 "2008-11-11T17:41:56Z")

</div>

On 11 Nov 2008, at 16:32, Sazima wrote:

> Hi Fred,
> 
> The audience is the average Internet user. Any idea on what mobile  
> browser capabilities to expect? Do you think WML is mandatory or can  
> we stick to xHTML?  
> No idea, not really my area of expertise
> 
> How did you generate xHTML views? Did you use any specific editor /  
> IDE?  
> rails does xhtml anyway.
> 
> Finally, how do you differentiate between your users?

We have a slightly peculiar setup but at the end of the day we decided  
cookies were enough.

---

<div class="post-metadata">

**Author:** ![Ricardo\_Sazima](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a87d85/32.png) [@Ricardo\_Sazima](https://www.ruby-forum.com/u/Ricardo_Sazima)\
**Post date:** [November 11, 2008, 6:06pm UTC](https://www.ruby-forum.com/t/rails-site-for-mobile-devices-too/153047/5 "2008-11-11T18:06:36Z")

</div>

So, cookies work after all? Any special way of setting it and/or  
handling?

Cheers, Sazima

On Nov 11, 2:41 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Ricardo\_Sazima](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a87d85/32.png) [@Ricardo\_Sazima](https://www.ruby-forum.com/u/Ricardo_Sazima)\
**Post date:** [November 11, 2008, 6:30pm UTC](https://www.ruby-forum.com/t/rails-site-for-mobile-devices-too/153047/6 "2008-11-11T18:30:07Z")

</div>

On 11 Nov 2008, at 17:05, Sazima wrote:

> So, cookies work after all? Any special way of setting it and/or  
> handling?

Same as normal, but like I said mobile browsers are likely to be more  
stringent when it comes to stopping you going overboard (or just  
deleting old cookies because they only allocate a small amount of  
space to cookies).

Fred

---

<div class="post-metadata">

**Author:** ![Ricardo\_Sazima](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a87d85/32.png) [@Ricardo\_Sazima](https://www.ruby-forum.com/u/Ricardo_Sazima)\
**Post date:** [November 12, 2008, 4:00am UTC](https://www.ruby-forum.com/t/rails-site-for-mobile-devices-too/153047/7 "2008-11-12T04:00:24Z")

</div>

Hi Fred,

Thanks for the help and patience! I’m almost getting what I need, but  
2 things are still missing (XHTML views and cookies/sessions). Can you  
provide a short example for them?

1. rails does xhtml anyway

2. Same as normal, but like I said mobile browsers are likely to be  
more  
stringent when it comes to stopping you going overboard =\> how do you  
set sessions and retrieve values? It’s really not working for me…

Cheers, Sazima

On Nov 11, 3:29 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Ricardo\_Sazima](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a87d85/32.png) [@Ricardo\_Sazima](https://www.ruby-forum.com/u/Ricardo_Sazima)\
**Post date:** [November 12, 2008, 10:29am UTC](https://www.ruby-forum.com/t/rails-site-for-mobile-devices-too/153047/8 "2008-11-12T10:29:41Z")

</div>

On Nov 12, 2:59 am, Sazima [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi Fred,
> 
> Thanks for the help and patience! I’m almost getting what I need, but  
> 2 things are still missing (XHTML views and cookies/sessions). Can you  
> provide a short example for them?
> 
> 1. rails does xhtml anyway

You don’t need to do anything(except I suppose putting the correct  
doctype and so on in your layout), you’ll get xhtml anyway

> 1. Same as normal, but like I said mobile browsers are likely to be  
> more  
> stringent when it comes to stopping you going overboard =\> how do you  
> set sessions and retrieve values? It’s really not working for me…

I never had to do anything different than on the desktop.

Fred
