"Media query" in a controller?

Is there a way to do what would be equivalent to a css media query in a
controller in order to decide which erb template to use when rendering a
page?

On Sat, Mar 1, 2014 at 4:58 PM, mksys [email protected] wrote:

Is there a way to do what would be equivalent to a css media query in a
controller in order to decide which erb template to use when rendering a
page?

No, and maybe.

First, go to http://www.w3.org/TR/css3-mediaqueries/ and see the
“media features” on which media queries are based.

Then examine a few http requests from a browser – do you see any
“media features” values in the request? If not, the answer is “no”.

However, if you control the page being linked from, you can certainly
pack any data into the request you want, though that has downsides
as well (sharing URLs, bookmarking).

HTH,

Hassan S. ------------------------ [email protected]
http://about.me/hassanschroeder
twitter: @hassan

What are you trying to achieve? If it is around picking up a different
template based on device type of the user, you can use the user agent
field passed along with each request to render different templates.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs