Changing Safari’s User Agent

Safari User Agent Menu

Yesterday, I asked “Are you Mac, or PC?”. There was a comment from Branedy that caught my attention…

“I use Safari on my iMac and iBook, at work I use Firefox, with the user agent set to IE to get past the company firewall.”

I thought this would be a perfect time to post this tip. If you are in a similar situation as Branedy, but you would prefer to use Safari, instead of Firefox, it is possible to change Safari’s User Agent very easily. It involves activating Safari’s hidden Debug menu.

First, quit Safari, if it’s already running. Then, open the Terminal application and copy/paste the line below, and hit return. You may be prompted for an admin password.

defaults write com.apple.safari IncludeDebugMenu 1

Now just relaunch Safari and you’ll see a new pull-down menu called Debug. The menu has a wealth of things you can do, one of them is change Safari’s User Agent.

If you decide you would rather not have the menu active, simply quit Safari, go back to the Terminal and copy/paste the same line again, except change the “1” at the end to a zero, like this…

defaults write com.apple.safari IncludeDebugMenu 0

11 thoughts on “Changing Safari’s User Agent”

  1. Actually I have my Safari set to debug mode, unfortunately I’m not allowed to use my Mac connected within my company firewall. So I use Firefox on a PC, masquerading as IE.

  2. Any way to more permanently spoof the browser into thinking it’s IE on windows other than the user agent? One of my employer’s websites has written some kind of code into the website to automatically check, and I’ve used this debug menu item, but it keeps finding out and blocking Safari.

  3. This does indeed work on a mac. Unfortunately, the site I need to access requires an activeX component to function properly. Since Safari doesn’t support activeX, I’m out of luck.

  4. Is there a way to edit the list of available user agents? A lot of sites like the new Yahoo Mail require a later version of Firefox.

  5. If you are a PC user and still want to change your Safari installation to include the Debug menu just do the following:
     
    1. Close Safari if it is running
     
    2. Open: C:\Documents and Settings\YOUR_USER_NAME\Application Data\Apple Computer\Safari\Preferences.plist
     
    3. Add the following two lines directly under <dict>
     
    <key>IncludeDebugMenu</key>
    <true/>
     
    4. Open Safari.
     
    Congrats, you are now rejoice in your coolness.
     
    – Peter Schmalfeldt

  6. guys.. need sum serious help… downloading safari to your computer (i.e. not having a mac, is it still poss to create a debug menu?? also sumthing more complicated. I receently created a website in dreamweaver which works great. however when i open it up in safari, all the table lines that i used to create my website (which i made invisible)were now showing. I was wandering if anyone had ne idea why this is??? Or how it could be changed??Bearing in mind it opens up fine with explorer?
    Thanks Tim

  7. Tim, in current versions of Safari it much easier to activate the Debug menu, which is now named the Develop menu. Go to the Advanced tab in Safari preferences and select the box labeled, “Show Develop Menu in Menu Bar”.

    In terms of your second question… welcome to the fabulous world of web development, where all browsers show things differently. It’s hard to give advice without actually seeing it, but make sure your table is set to border=”0″. And, don’t forget to test in Firefox, Opera, and Chrome browsers too. Good luck.

  8. Too bad this tip does not work any longer. In Safari 4, the changes done in the Develop menu are site specific. So you would have to manually change it for every Web site.

Leave a Comment