Welcome to WebmasterWorld Guest from

Forum Moderators: not2easy

Message Too Old, No Replies

Telling a mobile web browser where the desktop version of a site is?



11:43 am on Aug 16, 2013 (gmt 0)

5+ Year Member


I have a few websites that I have developed mobile versions of the same website for. I have setup a simple PHP mobile detector, that redirects visitors from the desktop version of each site to the mobile version of each site. All works well, redirecting from Desktop to mobile.

My question is, how can I tell mobile web browsers where the desktop version of a site is?

For example, when I view one of my mobile sites within the Google Chrome browser on my Android phone, there is a menu option "Request Desktop Site". When I select this menu option for sites that are in a sub-directory of the main site, such as www.mysite.com/mobile, it easily forwards the user to the desktop version of the site.

However, if I try "Request Desktop Site" for a mobile site that is on a subdomain, such as [m.mysite.com,...] Chrome can't seem to find the desktop version of the site.

Hope that makes sense?

Many thanks

Mr m


12:18 pm on Aug 16, 2013 (gmt 0)

WebmasterWorld Senior Member beedeedubbleu is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Media Queries?


5:27 pm on Aug 24, 2013 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member Top Contributors Of The Month

There are diff ways depending on how you got your mobile and desktop version.

If you have them on diff directories then include a link to the equivalent page on the other directory. It should be easier with a custom made CMS, otherwise if the pages have the same url base, you can include a simple javascript writing the right link from each page to the other one.

If you have the same content being served over the same URL detecting the device on the server then use a cookie, it should show and keep the right version for the user.

The feature you talk about "request desktop site" is mainly modding the user agent to tell the server "I'm a mobile device" or "I'm a desktop", this will work if you show your visitors the same url but you choose what to server on the server side based on the user agent.

The trick: it's not 100% guaranteed but mobile devices include the word "mobile" on their user agent string, desktop versions won't have that. I say it's not 100% safe because android is to fragmented you can find cellphone software modifications installed on tablets without that working as it should.

Featured Threads

Hot Threads This Week

Hot Threads This Month