On 22/05/07, omat <[EMAIL PROTECTED]> wrote: > > Hi all, > > Is it a good idea to use a middleware class to detect the browser > client looking at the HTTP_USER_AGENT so as to serve presentation > logic accordingly, for mobile devices or older browsers, etc...? > > I know this is mostly done by <!--[if IE 6]>, etc... tags in the html > document but I am not very familiar with this style. > > One pitfall I can think of is the bots. Googlebot for example can > detect I am serving different content for different clients and judge > that I am index spamming. > > oMat
In an ideal world you wouldn't have to do that, but if you find it absolutely necessary, you could trigger different output templates for different systems. But as a first - try making everything as clear as possible, so you wouldn't need to do such things in your code and complicate it further. Serve validated output, so you won't trigger the different quirks in different browsers when they encounter a "broken" section. Focus on structure, and lay out with CSS. Define CSS for different media - screen, print, mobile - and almost every sensible browser will handle your output as you want it to be. If you primary concern is mobile browsers, it would make sense to define two different sets of outputs, but try not to do this for every browser. People are trying to avoid such things as much as possible - it does make a big mess. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---