Re: Markup as a function of User-Agent

2007-06-21 Thread [EMAIL PROTECTED]

Yup... first, don't do it based on user agent. Guaranteed you won't
think of one, or the specs will change, or something will go belly up
on you. Do it on capability. If it's a small screen, do x, otherwise,
do y, whatever the UA is.
What really matters to you is the size of the thing, right?

So, on the simplest level, you use a snippet of JS to get the clients
browser window size (not resolution), and feed additional/alternate
CSS for it. See http://www.themaninblue.com/writing/perspective/2006/01/19/

Getting more sophisticated, you could have the JS make the check and
either set a cookie or append some querystring (?small=true, maybe) to
each url, which you could then pick up in your view, if you needed
COMPLETELY different content.

But that sounds messy to me, and just making a smart small-screen CSS
is pretty trivial.

The same trick is also very helpful for taking small-to-mid-size fixed-
width layouts and resizing them for very large windows.



On Jun 20, 1:43 pm, EagerToUnderstand <[EMAIL PROTECTED]> wrote:
> I would like to change the information/size of the returned HTML page
> depending on the User-Agent accessing the content.
> (Typically rendering a smaller page for a PDA than for a PC browser.)
> I know how to get hold of the User-Agent.  It feels to me like this
> must be a common requirement, yet I can not find info on it.  Anybody
> got a eloquent solution?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Markup as a function of User-Agent

2007-06-20 Thread EagerToUnderstand

I would like to change the information/size of the returned HTML page
depending on the User-Agent accessing the content.
(Typically rendering a smaller page for a PDA than for a PC browser.)
I know how to get hold of the User-Agent.  It feels to me like this
must be a common requirement, yet I can not find info on it.  Anybody
got a eloquent solution?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---