In some cases the user wants to access to the Desktop version of the site from a mobile device (sometimes the desktop version has more functionality).
The script handles this situation as well, it checks if the previous page hit was one from the mobile site (we can assume the user is trying to access to the “desktop” version from a mobile device) or if the url contains a specific parameter.In these case the redirection won’t occur.
To keep the user in the desktop version for the whole session, sessionStorage object has been used, specifically an item will be stored to distinguish if we’re browsing through the desktop site. There is a fallback for old browsers that don’t support sessionStorage, and a cookie will be used. The cookie that makes the access to the desktop version from a mobile device possible will expiry in one hour or you configure the expiry time.
More about this here: https://github.com/sebarmeli/JS-Redirection-Mobile-Site/