dotMobimobiThinkingmobiForgemobiReadyDeviceAtlasfind.mobiInstant Mobilizer

User-Agent Switcher for Safari 4

atrasatti's picture
Posted by atrasatti 36 weeks 3 days ago
Bookmark and Share

The User Agent Switcher plug-in for Firefox has been a GREAT add-on and we all love it. 1 year and 27 weeks ago Ronan wrote a really simple, but useful configuration file for it that is available here on mobiForge (if you use Firefox it's a MUST: User Agent Switcher config file).

Since Safari 3 it is possible to switch the User-Agent string the browser sends to the server. Initially it was to emulate other browsers, then they wisely added the iPhone and the iPod Touch so that designers could test their new iPhone-specific sites. Unfortunately it was not possible to personalise that list.

With the release of Safari 4 and thanks to a nice hint on Mac OS X Hints, I've built my own list of mobile devices. See how it looks like now (forgive the Italian at the bottom):
Preview of UA Switcher

Of course the file is also available for download as an attachment to this article. Install instructions are quite easy:

  • Close Safari
  • Go to your Applications folder
  • Right-click or CTRL-click and select Show Package Contents
  • Enter in Contents and then Resources
  • Back your UserAgents.plist to a safe place
  • Copy the UserAgents.txt that you downloaded into UserAgents.plist
  • Start Safari

The file is just text, so if you want to add or change the list of devices it should be easy enough, it took me longer to select the User-Agents than editing. ;)

AttachmentSize
UserAgents.txt13.04 KB

Posted by atrasatti 36 weeks 3 days ago

atrasatti's picture

Andrea Trasatti is Director of Technology Strategy at dotMobi where among the other things he is leading the design and development of DeviceAtlas.
Prior to this Andrea has been a system administrator and a software developer for more than 10 years and a consultant for more than 5 years.
In Italy Andrea started developing the first WAP sites in late 1999 when the first WAP phone was about to be released. Since then he has been developing some of the most innovative services for mobile devices.
Andrea has also actively participated to W3C work first as an invited expert and later as author of one of the documents that was published by the Device Descriptions Working Group.

Posted by toddvirgil 21 weeks ago

Is it possible to do this on the PC version of Safari?

Posted by ruadhan 21 weeks ago

Quote:
Is it possible to do this on the PC version of Safari?

Yes - with a little bit of coaxing...

To enable user-agent switching, you need first to activate the Developer/Debug menu. On Windows, you need to open up the Defaults.plist file (usually located at C:\Program Files\Safari\Safari.resources\Defaults.plist) and add a new key.

Add the key & value:

	<key>IncludeDebugMenu</key>
	<true/>

to the file before the closing </dict> tag.

Now restart Safari and you should have a nice new menu at your disposal!

Ruadhan O'Donoghue
dotMobi

Posted by savas_2000 17 weeks ago

I followed the instructions, but how can I switch from UA with Safari (using Mac OS X)?