问题
I'm looking for a User Agent Switcher for Chrome.
Searching the Chrome Web Store does not come up with a simple switcher. I understand I can run the browser via command line and arguments: Google Chrome: Change User Agent to Access Website.
Is there a user agent switcher built in to the UI of Google Chrome? If so, how do I access it?
回答1:
Chrome Developer Tools (as of version 17+) have the ability to supply custom User-Agent
header
Bring up the developer tools by pressing f12
Look in the Console "drawer" (make it visible if not visible)
Click the Emulation tab in the console drawer.
Tick "Spoof user agent" and select an agent (or enter your own User-Agent string using the Other... option).

回答2:
dunno but i found this:
http://www.hacker10.com/tag/internet-browser-headers/
saying:
Chrome browser, User-Agent Switcher extension: UPDATE: Addon erased from Chrome Store
and this where they say (as you mention) you can do it with a command line switch:
http://www.google.com/support/forum/p/Chrome/thread?tid=64e4e45037f55919&hl=en
for example, this is how to make chrome report itself as IE8.0 on my machine C:\Users\XXXX\AppData\Local\Google\Chrome\Application\chrome.exe --user-agent="Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 3.5.30729)"
If you really just want to change the user agent for some sites or testing one little thing you could do to make it faster is create shortcuts to the site that includes the switch of user agent. at least that way its not so fiddly.
another silly idea: If you need exactly two user agents in chrome you could use canary build as one, I do this to have my apps account and google account open at the same time.
回答3:
In version 66 of Chrome the option to set User Agent is hidden in Network Conditions, which can be accessed by pressing f12 to bring up the developer tools box > clicking the 3 dots next to the close button of the developer tools box > More tools > Network conditions
Further reading: https://developers.google.com/web/tools/chrome-devtools/device-mode/override-user-agent
回答4:
You can use this technique to change UA. It relies on changing the User-Agent header using the (still experimental) webRequest API
回答5:
You can use webRequest API to create a chrome extension to modify the headers. When OP asked this question, this API may not exist or may be in experimental phase but now this api is quite stable.
chrome.webRequest.onBeforeSendHeaders.addListener(
function(details) {
for (var i = 0; i < details.requestHeaders.length; ++i) {
if (details.requestHeaders[i].name === 'User-Agent') {
details.requestHeaders[i].value = "Android_Browser" // Set your value here
break;
}
}
return { requestHeaders: details.requestHeaders };
},
{urls: ['<all_urls>']},
[ 'blocking', 'requestHeaders']
);
If you are looking for an already built extension, you can try Requestly where allows you to easily setup rules on website URLs or domains so that whenever that website is opened in browser, the User Agent is automatically overridden. The best part here is that you can simultaneously run multiple rules for multiple websites.
Most of the other options either allow to override User Agent for one browser tab or all of the tabs.
Here is a screenshot for your reference:
For more info, please visit blog: https://medium.com/@requestly_ext/switching-user-agent-in-browser-f57fcf42a4b5
To install, visit chrome store page: https://chrome.google.com/webstore/detail/requestly-redirect-url-mo/mdnleldcmiljblolnjhpnblkcekpdkpa
The extension is also available for Firefox. Visit http://www.requestly.in for details.
回答6:
If you would like change the user agent in chrome you can not do it in the developer tools by checking the spoof user agent box in the emulation tab.

来源:https://stackoverflow.com/questions/7561271/user-agent-switcher-for-chrome