How does Chrome's “Request Desktop Site” option work?

前端 未结 4 1702
半阙折子戏
半阙折子戏 2020-12-04 10:46

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

4条回答
  •  爱一瞬间的悲伤
    2020-12-04 11:33

    One other slight difference is that the request appears to have been to the last intentionally entered URL before any re-directors moved it. For example:

    Given: somesite.com sniffs the agent, sees Android, and does a document.location += "/m";

    Then: the browser will have a URL of somesite.com/m

    But: if you "Request desktop site" it will change the User-Agent and re-request from somesite.com

    Unless: you had gone directly in on the mobile URL of somesite.com/m in the first place, in which case it just reloads somesite.com/m.

    I would expect that this works with HTTP 301 and 302 redirects, I know it works with document.location changes (at least as described), and would speculate that it works with refreshes.

提交回复
热议问题