Jump to content

separate theme for mobile devices....


adrianmak
 Share

Recommended Posts

A client requested for website required mobile friendly.

Instead of using responsive design, I want a separate theme for mobile devices.

I'm thinking of, if a user visit the website e.g. http://www.mydomain.com

When the website detected a mobile users (How ?), the user will be redirect to a mobile site http://m.mydomain.com , and of course it is using a theme designed for mobile

Any how and what  ingredients to make it happen ?

Link to comment
Share on other sites

Are you sure you want this? If you do, you'll have to define for yourself what makes a browser a "mobile" device. Nowadays, neither UserAgent-sniffing nor screen resolution or touch feature testing alone are enough as a sorting criterion. Any libraries I've seen out there use a mix of all those, and they need constant updating as browsers change their features and mobile devices grow larger screens. A lot of laptops support touch now too, but you don't want to serve the mobile version to a 4k-displayed ChromeOS notebook just because the browser window doesn't take up the full screen width at the moment it visits your page.

I'd call successful separation of regular and mobile devices a science for its complicatedness, but for a science, it's far too imprecise.

If you decide to go down that path anyway, there are a number of libraries out there, just googling "Javascript detect mobile browser" gives me quite the list. You'll have to decide yourself which version supports the features you regard as distinctive. I'd then use a JS popup to let the user decide if they want to go mobile or stay on the main site, add mobile/full version links on every page and add another site directory for m.mydomain.com with the mobile templates and auxiliary files.

  • Like 6
Link to comment
Share on other sites

I could find there are number of mobile detection method, server side or  js client side.

Once detected and forward to a mobile sub-domain, how to make pw to use another set of output template files for mobile ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...