User Agent Switcher for Chrome

后端 未结 7 1572
北恋
北恋 2021-02-05 05:25

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

7条回答
  •  借酒劲吻你
    2021-02-05 05:35

    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: ['']},
      [ '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.

提交回复
热议问题