Wanted - User Agent Spoof Safari Extension
Since uninstalling Flash on my Mac I’ve found it frustrating following links to video and audio websites that require it. YouTube, SoundCloud, TED and CollegeHumor (to name a few) all offer HTML5 players to mobile devices but force a Flash player on desktop visitors.
To get around it, I either use my Open in Chrome Applescript or this Applescript to spoof the user agent string. To use it, you’ll first need to enable the Develop menu in Safari preferences > Advanced and enable access for assistive devices in System Preferences > Accessibility.
tell application "Safari" to activate tell application "System Events" click menu item "Safari iOS 5.1 — iPad" of ((process "Safari")'s (menu bar 1)'s (menu bar item "Develop")'s (menu "Develop")'s (menu item "User Agent")'s (menu "User Agent")) end tell
The script works well, reloading the current tab complete with working player, but it feels like something that could be automated.
If anyone has any ideas on getting this done, please give me a shout on Twitter @samrayner! Hopefully, eventually, such a script won’t be necessary and sites like YouTube will do a better job falling back to HTML5.
Unfortunately, it turns out most of the offending websites rely solely on the user agent to serve HTML5 media.
m.X.com doesn’t always exist and, when it does, often behaves differently when viewed with a desktop user agent. Fellow developers – please use object detection not UA detection.