User Agent Switcher for Chrome
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 开发者_StackOverflowuser agent switcher built in to the UI of Google Chrome? If so, how do I access it?
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).
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.
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
You can use this technique to change UA. It relies on changing the User-Agent header using the (still experimental) webRequest API
Update for 12/2019
OPTION 1: Chrome Developer Tools
Chrome's built-in user-agent switcher has moved several times, but it seems to have stayed in one place for the past few years. As of the time of writing, here's how you get it:
- Open DevTools: hit F12 or right-click and select "Inspect."
- Open the drawer (the bottom pane) if it is not already open: hit Esc
- Go to the "Network conditions" panel. (You may need to click the ⋮ menu button on the left to view a list of all available panels.)
- Next to "User agent," deselect "Select automatically."
- Select a user agent from the dropdown or enter a custom string in the text box.
For the official documentation, which has (presumably) up-to-date instructions with screen grabs, go to: https://developers.google.com/web/tools/chrome-devtools/device-mode/override-user-agent
OPTION 2: Extensions
If you'd like a more convenient or feature-rich option, or if you're using a chromium browser other than Chrome, your best bet is a browser extension. Here are several that are up-to-date, and well-reviewed as of the time of writing:
- User-Agent Switcher and Manager
- User-Agent Switcher
Google also offers its own user-agent extension for Chrome (which does apparently work in some other chromium browsers, according to an Edge user):
- User-Agent Switcher for Chrome
A few notes on this last option: Although Google's UA switcher extension was updated only a few months ago (as of 12/19), reviews indicate that it might be somewhat out of touch when it comes to current browsers. It may also cause performance issues if you leave it enabled all the time. That said, this extension does work, and it is overall positively reviewed, so it could be a viable option if you want a convenient, albeit simple, UA switcher for Chrome.
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-f57fcf42a4b5To 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.
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.
精彩评论