Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Chrome's "Request Desktop Site" option work?

For iOS google chrome, when a user hits the "Request desktop site" button what does the browser do to try to bring up a desktop site? I imagine some sort of header on the request that sites are looking for, or something similar?

like image 545
butallmj Avatar asked Jul 28 '12 15:07

butallmj


People also ask

What does requesting desktop site do?

When websites are queried from a mobile browser in a smartphone, a mobile version of the site will be retrieved if available, and the user has little choice. However, because mobile sites may have abbreviated content, a "Request Desktop Site" option was added to iPhone and Android browsers.

What does request desktop website do on iPhone?

Step 2: Once you load the webpage, find the extension icon on the Safari address bar. Tap on it. Step 3: Select Request Desktop Website and Safari will reload the webpage in desktop mode. You can return to the same extensions menu and request a mobile website to browse on iPhone.


2 Answers

I think the only difference is the User-Agent: header in the request.

Here are the User-Agent headers sent by Chrome on my Android device:

Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76K) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19  Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.45 Safari/535.19 

Notice the word "Mobile' in the first one, and also the mention of Android system and device. Checking these, I see that it also provides false information - namely X11 and x86_64 - to closely match the value sent by the Desktop Linux version of Chrome.

like image 113
dsh Avatar answered Sep 20 '22 13:09

dsh


Just wanted to point out that Chrome now not only changes the User-Agent but also ignores the original viewport meta tag if you "Request Desktop Site". Thus it won't be necessary to sniff the User-Agent anymore and you can rely on the viewport change as most responsive sites will automatically do. See this Change for further reference.

like image 22
Thomas Avatar answered Sep 19 '22 13:09

Thomas