Search code examples
mobilemobile-websitegoogle-search

How does google (search) serve its mobile site?


The site itself isn't responsive using CSS as far as i can tell. Is it a dedicated mobile site that is loaded based on HTTP Content Type header?? The URL is shared between both desktop and mobile. How does this work??


Solution

  • Probably using the User-Agent HTTP header. This shows the platform as well as the browser type you are using. That way you can enable desktop mode even on mobile devices. If you change to desktop mode on mobile the phone sends a different User-Agent string (One that is like a desktop user agent). The server then serves a different page than normal

    Edit:

    Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36
    

    Thats my user String. You can see Windows NT 10.0, WOW64 there. That translates into Windows 10 64Bit

    Mozilla/5.0 (Linux; U; Android 4.0.3; ko-kr; LG-L160L Build/IML74K) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30
    

    Thats the Android webkit user agent string. Android is basicly Linux. These user agent strings often have android version, language and device model in them. In the Above example it woult be an LG-L160L running Android 4.0.3 with South Korean language.