Some websites just have to accept only Internet Explorer (I know, disgusting). The admins/developers (or their clients?) don’t seem to know there are other operating systems available, except for windows. Working on Mac is a no-no for them. The following is a little note of how I fought one of such sites.
/* Update on Feb 16, 2013: add simple aliases for quick change. Since the time of writing this post, I’ve come across the tool called
defaults that comes with OS X, and allows to read/write configs easier. Therefore, I’ve added the following simple aliases to my
The names of the aliases define the function. The nice thing here is that after issuing one of these commands, new Safari windows will have the set user agent. */
Here are some steps I took to trick a site into believing I used IE while using Safari actually. First of all, enable Safari’s debug menu to be able to change your User-Agent:
Restart the app, open the site, select Develop / User Agent / Internet Explorer 9.0, and make sure the current page works as needed. It’d be the end of the story, but Safari doesn’t save the option even for new tabs, let alone after restarts. Have to change the default user agent then with the help of an old article about that.
I opened the
~/Library/Preferences/com.apple.Safari.plist file, in vim of course, and… it turned out to be of binary plist format. I knew there was a tool to convert between plist formats, but we have vim here, don’t we? There must be a way to do the conversion automatically! Thanks to the article, I placed the script in
~/.vim directory and appended my
.vimrc file with the following:
Now vim can edit binary plist files. So, open the
~/Library/Preferences/com.apple.Safari.plist file and add the lines:
Restart Safari, and IE 9.0 should be your default user agent. I comprehend it’s not a very useful thing to do in general, but I don’t use Safari for other sites anyway.
A better option would be to have a different setup for Safari, so I could run two Safaris with different user agents. However, I couldn’t find any information about this feature.