Force HTML5 video use in Safari 5 on the Mac

Nov 19, '10 07:30:00AM

Contributed by: crarko

If you prefer HTML5 video to Flash, here is a method suggested by John Gruber to employ User Agent masquerading in Safari 5 to try to force sites to serve it to you.

If you turn on the Develop menu in Safari (Preferences » Advanced » check the box), you get the option to choose the User Agent string Safari will hand to a site to tell what browser it is.

From the Develop menu, Choose User Agent » Mobile Safari 3.2.2 - iPad and the site will switch to HTML5 if it supports it. You will need to refresh the page if you've already loaded it.

The setting will only last for the current browsing session. It can be made persistent using the following command (note that this is slightly different than the command linked to in the article; that one produced errors when I tried it in Terminal):

defaults write com.apple.Safari CustomUserAgent "'Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10'"
This can be undone by:
defaults delete com.apple.safari CustomUserAgent
[crarko adds: Read Gruber's article for some caveats associated with making the permanent change. Remember it may make sites think you're using an iPad. It's possible the Windows version of Safari 5 can do this as well, but I haven't tried it. This hint discusses adding the iPad User Agent to the list if you are running a version of Safari that doesn't already have it.]

Comments (7)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20101119054008513