Change the Browser User Agent in Chrome, Safari, & Firefox

Jan 16, 2013 - 14 Comments

Safari icon A web browsers user agent is how a website knows what type of computer, operating system, and browsing app you are using. Some sites serve different themes, CSS, content, or even different sites to different browsers and OS’s, and many developers often need to change their own user agent to be able to test these abilities and build these alternate sites.

We’ll cover how to change the user agent for all popular modern web browsers available to the desktop user in Mac OS X and Windows, including Chrome, Safari, and Firefox.

How to Change the User Agent in Chrome

All new versions of Chrome include the ability to change user agent very easily, and it’s more powerful with more options than the simplified options available to Safari users. With Chrome’s user agent overrides, the user agents device resolution can also be specified, forcibly redrawing the page within that resolution. There is no need to enable the user agent settings in Chrome, you just have to find them under the developer options:

  1. Open Chrome and pull down the “View” menu, go down to “Developer” and select “Developer Tools” to open the developer panel
  2. Click the three dots button in the far right corner, then select “More Tools” and select “Network Conditions”
  3. Look for “User Agent” and uncheck the box next to ‘Select Automatically’ to reveal all user agent options in Chrome
  4. Select an optional user agent from the dropdown menu to activate that user agent in Chrome

How to change user agent in Chrome

This works in Chrome for Mac, Windows, and Linux.

In old versions of Chrome, you can change the user agent as follows:

  • Open Chrome and pull down the “View” menu, go down to “Developer” and select “Developer Tools” to open the developer panel
  • Click the gear icon Settings button located in the lower right corner
  • Click the ‘Overrides” tab to find the User Agent options, select a user agent out of the pulldown menu, modify an existing one, or enter a new user agent

Change the User Agent in Chrome

Chrome also instantly redraws pages with the new user agent, and if device metrics are set it will also use that devices set resolution size when redrawing the page.

How to Change the Browser User Agent in Safari

By far the easiest way to change a user agent on the Mac is through Safari’s Develop menu, if that hasn’t been enabled yet we’ll cover that and also show how to change user agents easily:

  • Open Safari, then pull down “Preferences” from the Safari menu
  • Click on “Advanced” tab and check the box next to “Show Develop menu in menu bar”
  • Close out of Preferences and find the new “Develop” menu alongside “Window”, pull that down and select “User Agent”
  • Pick any pre-specified user agent or select “Other” to use a different user agent string

Change the User Agent in Safari

Note that if you hover over a specific user agent, the exact UA string used will appear in a yellow box alongside the menu item.

After selecting any of the user agents, you will find the currently open web page will refresh. If the page in question happens to serve different information to alternate browsers you may find the page looks different. For example, changing a user agent to a mobile device and mobile browser may cause some web pages to send you to their mobile websites, or serve a different looking page through a responsive layout.

How to Change Browser User Agent in Firefox Without Using an Extension

Firefox can also do this by default, though it’s arguably the most clumsy of the modern browsers and thus not really recommended since some Firefox extensions handle it better.

  • Enter about:config into the URL box and hit return
  • Search for “useragent” (one word) and create a new string titled “general.useragent.override”
  • Place the user agent in and choose “OK”

Keep in mind that changing the user agent does not change the way the web browser renders pages itself, unless it is being served user-agent specific content. For example, using an IE8 user agent is not the same as visiting a page with IE8 and letting it render the page, a need often mandatory for web developers. For that you will need to actually take the time to run Internet Explorer in a virtual machine on top of Mac OS X, that is free and fairly easy to set up.

What about spoofing user agents from the command line?

For the command line junkies, you can also use curl for this purpose and retrieve a pages source code as a different browser or OS, the basic syntax is:

curl -A "UserAgentString" http://url.com

The videos below demonstrate enabling the ability and changing the browser user agent in Safari under Mac OS X, and also how to do this in Chrome under Mac OS X, Windows, or Linux:

And Chrome:

Keep in mind that changing the user agent does not change the way the web browser renders pages itself, unless it is being served user-agent specific content. For example, using an IE8 user agent is not the same as visiting a page with IE8 and letting it render the page, a need often mandatory for web developers. For that you will need to actually take the time to run Internet Explorer in a virtual machine on top of Mac OS X, that is free and fairly easy to set up if necessary.

Thanks to @ImpechCerrato for the tip idea, you can follow @OSXDaily on Twitter too.

.

Related articles:

Posted by: William Pearson in Mac OS, Tips & Tricks

14 Comments

» Comments RSS Feed

  1. Nob som says:

    curl -A “UserAgentString” http://url.com

  2. @tipoisso5 says:

    Ok

  3. opanmoedy19 says:

    this is a real good

  4. Vicky sathe says:

    Add

  5. akib says:

    man, how can i delete that string????? (I m using firefox)

  6. Me Again says:

    Edit: actually, my attempt to create a custom user agent did not work. I could input it into the field, but for some reason, it does not save it.

  7. asdf says:

    Unfortunately, outdated solution for Chrome; can article be updated, please?

    See flipflopmedia’s response for the latest solution for Chrome; I used those instructions, then went further and selected Custom and input my own.

  8. flipflopmedia says:

    How to Change the User Agent in Chrome on

    Version 62.0.3202.94 (Official Build) (64-bit)

    From the Menu select “More tools” > “Developer tools”

    From the Developer Tools Menu select “More tools” > “Network conditions”

    There You Have It! “User Agent” is 3rd on the List. Deselect “Select automatically” and select Agent of choice!

  9. Luthor says:

    From looking at these methods to change user agent I really gotta say Maxthon does it in the easiest way. Settings > Advanced Setting > Customize UserAgent String. Done.

    Somebody get me a big red Staples button because “That was easy.”

  10. Jane says:

    Very helpful thank you. I had a web page that wouldn’t display. Spent 2 weeks working with IT. Only changing useragent worked. Now I’m happy. Instructions worked for Safari. Chrome instructions didn’t work and appear to be out of date.

    Thank you!!!!!

  11. Jake says:

    The Army insist on making some of it’s applications very IE friendly, making it tough to do things at home. This tip is fantastic!

  12. Khai says:

    This really saves me from having to install an unnecessary extension. Thanks!

  13. Ryan says:

    This is a really good tip. Is there a way to change it on Safari for iPhone? Say, to stop websites from automatically loading as a mobile version?

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site