Alex Rivera | Logout

Letting people revert back to desktop site from mobile site

Asked 2012-10-01T10:04:11.370
8

My website will revert visitors to a seperate mobile site, this seems fairly simple after reading a few guides online.

However, I would like people to be able to click a link on the mobile site which will then take them to the desktop site.

The problem I see is that if I link back to the desktop site it will just redirect them back if they are on mobile?

How can I get around this?

Edit
Report

2 Answers

1

You can use Cookies, Session or Local Storage such that when a user clicks on "go to desktop site", it sets a value.

Let's say you set the name to be "mobileOff" and the value set to "1" or "true" when a user on a mobile phone clicks on "Go to Desktop Site". Then, wherever you're doing your mobile check, add a conditional to check for the mobileOff in the user's cookie/session/localStorage, if it's set to true, bypass the automatic mobile redirect, otherwise, load the main desktop site.

answered 2012-11-04T21:15:48.753
1

you should combine user agent method to detect device clubbed with query string to this sort of functionality. so lets assume your link is

site/default.aspx

if some one hits this page check the user agent and give in the response the appropriate site or event better if the device detected if a mobile device simply redirect to m.yourdomain.com/site/default.aspx
but if some one hits the page site/default.aspx?type=desktop then override the behaviour of checking the useragent and render the desktop site.

never ever you should first load the desktop site and then via javascript reditect to a mobile site. do this using user agents server side.

answered 2012-11-05T13:10:32.107

Your Answer