Chrome has a --user-agent
flag, but sometimes you want to modify the user-agent for only a select number of websites (e.g. Microsoft Outlook Web Access).
This is the simplest (code-wise) user-agent switcher possible, but not a very usable one. If you want a more full-featured user-agent switcher, see User-Agent Switcher for Chrome.
Steps to use:
- Download the extension and modify
manifest.json
: Set thepermissions
andmatches
to the wildcards of the URLs you want the spoof to apply to. - Navigate to chrome://extensions
- Check Developer mode
- Load unpacked extension... and select the folder where you saved this extension.
Since it uses chrome.webRequest
apis which are not yet in stable, it may not work in your browser yet (if you haven't signed up for the dev channel). See the bug to track progress of the API becoming stable.
To change the User-Agent that this extension spoofs, edit both content_script.js
and background.html
.
See also User-Agent Switcher for Chrome for a more full-featured experimental extension. It most likely works and is easier to use, but theoretically it might fail on some websites that read <script>var ua = navigator.userAgent</script>
at the very top of the page using Javascript.