Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Permanently change Safari's User Agent string Web Browsers
Most know about enabling the Develop menu in Safari, and how to pick a different user agent using its User Agent entry. However, Safari will revert to automatic mode between launches; it will not remember your setting. Here's how to improve it's memory and remember your setting between launches.

In order to make the User Agent setting stick between launches of Safari, one has to edit a plist file (just entering the User Agent string in the Custom option of the User Agent menu won't stick). To make the changes, quit Safari and open your user's com.apple.safari.plist file, which you'll find in your user's Library/Preferences folder in an editor capable of opening binary plist files. (Otherwise, you'll have to convert it between binary and ASCII first.)

In the plist file, find CustomUserAgent, and edit the value string. To determine the value string to use for your desired user agent, hover above the desired entry in the Develop » User Agent menu. Enter that value, save the file and relaunch Safari, and you should be good to go. Note that this was only tested on 10.5.7 with Safari 4.0.1.

A non-editing alternative is to use MacPilot, which will do the same thing for you.
    •    
  • Currently 2.27 / 5
  You rated: 5 / 5 (11 votes cast)
 
[25,906 views]  

Permanently change Safari's User Agent string | 7 comments | Create New Account
Click here to return to the 'Permanently change Safari's User Agent string' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Permanently change Safari's User Agent string
Authored by: Stormchild on Jul 06, '09 10:37:40AM

Most people should never do this.

If you don't know exactly what this is and why you're changing it, don't touch it.



[ Reply to This | # ]
Permanently change Safari's User Agent string
Authored by: Felix on Jul 06, '09 01:07:45PM

@"Most people should never do this."

That's ridiculous...there are several valid reasons to change the User Agent although I agree with barefootguru, leave it on the default unless needed to give Safari "credit" on all the sites you browse.



[ Reply to This | # ]
Permanently change Safari's User Agent string
Authored by: micmoo on Jul 06, '09 10:50:06AM

defaults write com.apple.Safari CustomUserAgent "\"Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3\""



[ Reply to This | # ]
Permanently change Safari's User Agent string
Authored by: barefootguru on Jul 06, '09 12:43:50PM

Safari's running at 8% market share. Don't spoil the rate by changing the user agent string more than you have to :-)



[ Reply to This | # ]
The main problem isn't really giving credit
Authored by: vykor on Jul 06, '09 01:19:15PM

The main problem for the user isn't really giving Safari credit, so much as that many websites detect your browser via the user agent and deploy custom CSS or JavaScript. This is usually used to work around edge cases & bugs in site rendering or script execution -- especially for Javascript-intensive, AJAX-y sites.

If your user agent doesn't conform to the "Mozilla/xx ... Safari ... WebKit" style string exactly, the web app may fail to detect your browser correctly. You may get served the wrong thing, which makes the site render badly (CSS for Mozilla browsers that don't get the -webkit-* attributes for example, or even an IE stylesheet), break certain script functions, or skip browser-specific optimizations.

The moral of the story: it's in your best interest to use this appropriately, not to change your browser to report "Vykor's Awesome Intarweb Engine/1.0".



[ Reply to This | # ]
The main problem isn't really giving credit
Authored by: Felix on Jul 07, '09 04:27:23AM

I don't disagree with anything you've written! As I said before...leave it on the default setting (which will also help the various web site owners get a feel for the volume of Safari traffic) UNLESS Safari won't properly render/display a site. Then try changing the UA while you're on the site.

Of the sites I frequent on a regular basis, few require the workaround anymore.



[ Reply to This | # ]
Permanently change Safari's User Agent string
Authored by: grawker on Jun 16, '10 10:27:06AM

Hi. I tried this trick on OS 10.5, and Safari 4.0.4, but it isn't working. Does anyone know if there is an updated way to do this? I'm trying to spoof the UA string so I can use an automated testing framework against Safari, spoofing iPhone.

Thanks,
Matt



[ Reply to This | # ]