Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

How do I use the mobile theme if the $_SERVER['HTTP_USER_AGENT'] is mobile, and use the desktop theme if it is desktop?

share|improve this question

2 Answers

up vote 3 down vote accepted

I would suggest you to use browsecap module to detect what browser users use and switchtheme module to switch to correct theme depending on the browser they use.

share|improve this answer
Thanks @Alex...these modules are awesome. – ninjascorner Mar 15 '12 at 7:41

The mobile tools module also integrates with the browscap module as well as the wufrl module, though I recommend starting with browscap instead of wufrl. Wufrl is more complicated to set up and also not open source anymore.

Mobile tools gives you some handy options like choosing different themes for iPhone vs. Android vs Nokia, Panels module integration, special (optional) permissions for mobile users, and other options. You can also force mobile users to use the mobile theme or let them choose between mobile and desktop a la the switchtheme module.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.