Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Wildy

macrumors 6502
Original poster
Jan 25, 2011
323
1
While some websites (such as Youtube) have dedicated HTML5 versions, most other websites are still using Flash only. Interestingly, if you browse these sites on a mobile device then you'll find that they have actually been adapted to run without Flash. The premise is, using a special filter for GlimmerBlocker, we can have a system-wide setting in place which will spoof the user agent of an iPad to coax these websites into displaying Flash-free HTML5 goodness. Why are we spoofing an iPad? Well because it has a resolution similar to that of our PPC machines - the result is that we get a cleaner layout, but one which was designed for a bigger screen as opposed to a tiny mobile.

You will need GlimmerBlocker installed and running.

gb1.png

In the filters tab, add a new filter to store the rule in.

gb2.png

Add a new rule and leave everything as-is except Action, which needs to be changed to Modify Request. If you only want the to view certain sites then you can add them to the Host box - you will need to duplicate the rule for each site.

gb3.png

On the Request tab, copy and paste the following code:
Code:
var ua = gb.request.headers["User-Agent"]
ua = ua ? ua.toString() : "none"; 
//if (ua.match(/Safari/)) // Uncomment this line if you only want a single browser to display in mobile mode
	gb.request.headers["User-Agent"] = ["Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10"];
If you only want to apply this rule to a single browser, then uncomment the line mentioned and change Safari to whichever browser you want it to apply to.

You should be all good to go!

Quite a few browsers have a user agent changer built in, but I use Stainless which does not - hence why I created this.

Enjoy!

gb4.png
 
Last edited:

B-G

macrumors regular
Dec 14, 2011
179
20
Excellent work! This is indeed a very cool and useful trick. I was experimenting with this myself, and the problem I was having was that I wanted to be able to enable UA spoofing only on one browser. I see that in your filter you can choose to do that when the user agent of the targeted browser matches a precise string. This is a very elegant solution. I can see only two problems with that:
1) it seems that GlimmerBlocker won't let you alter rules in a subscribed filter, so the user will have to copy and paste the single rule in your filter in a personal one, and then uncomment the required instruction.
2) every time the targeted browser is updated its user agent is changed, so it is necessary to manually edit the rule.
Other than that your filter works fine. I prefer to enable UA spoofing only on selected sites (that's because on most sites I already get html5 video through ClickToPlugin in Safari/Webkit) but it's only a matter of duplicating the rule in the filter and altering the targeted URL, and that's very easy and fast to do.

If you don't mind I would like to put a link to this thread here as a reference.
 
Last edited:

Wildy

macrumors 6502
Original poster
Jan 25, 2011
323
1
Ah, that's where that thread went! I was actually looking for that so I could post this there, rather than start a new thread. But by all means, feel free.

I didn't realize you can't change the rules of subscribed filters - I shall update the instructions. To make things easier, I could use a regex to strip out the browser name from the UA string instead of requiring a complete one - this should work fine for browser updates too.

EDIT: Updated to reflect changes.
 
Last edited:

skateny

macrumors 6502
Jul 19, 2012
448
0
New York, NY
THIS is cool.

Yeah it is.

Thanks to the OP for your good work.

This reminds me of a work-around either on MR or somewhere else, that entailed tricking Web sites into treating your PowerPC in the way they would an iOS device. As I recall, I think Fluid was involved.

Anyway, this is just another reason to enjoy working with PowerPCs. Stuff like this comes from years of needing to adjust to technologies that have sadly left behind some very good machines.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.