KISS πŸ‡ΊπŸ‡¦

Stop the war!

Stop the war in Ukraine! Fuck putin!

More information is at: https://war.ukraine.ua/.

There is a fund to support the Ukrainian Army: https://savelife.in.ua/en/donate/, and there is a special bank account that accepts funds in multiple currencies: https://bank.gov.ua/en/about/support-the-armed-forces. I donated to them. Please donate if you can!

Killer putin

Killer putin. Source: politico.eu.

Arrested putin

"It hasn't happened yet, but it will happen sooner or later. Beautiful photo, isn't it?" Source: twitter.

Safari and IE

| comments

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 ~/.zshrc/~/.bashrc:

1
2
alias safari_be_ie='defaults write com.apple.Safari CustomUserAgent "\"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)\""'
alias safari_be_safari='defaults write com.apple.Safari CustomUserAgent ""'

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:

1
defaults write com.apple.safari IncludeDebugMenu 1

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:

1
source ~/.vim/vim_plist_script.txt

Now vim can edit binary plist files. So, open the ~/Library/Preferences/com.apple.Safari.plist file and add the lines:

1
2
<key>CustomUserAgent</key>
<string>Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)</string>

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.

Comments