Skip to Content
Greasemonkey Hacks
book

Greasemonkey Hacks

by Mark Pilgrim
November 2005
Intermediate to advanced
496 pages
11h 9m
English
O'Reilly Media, Inc.
Content preview from Greasemonkey Hacks

Hack #78. Bypass Weight Watchers' Browser Checker

For some reason, WeightWatchers.com doesn't like Firefox.

Sadly, in 2005, there are still many sites that intentionally discriminate against minority browsers. WeightWatchers.com is one such site. The developers think they have "optimized" it for Internet Explorer, and the site intentionally shunts all other browsers to a dead-end "site requirements" page. Now, if they were doing something like using ActiveX, we would have little recourse. But they're not; they're just being stubborn.

This hack bypasses their Site Requirements page and takes you to their home page, which works just fine in Firefox (and pretty much every other browser).

Tip

Some sites include a browser check on every page. You can usually access such stubborn sites by installing the User Agent Switcher extension from http://chrispederick.com/work/firefox/useragentswitcher/ and setting your User Agent to Internet Explorer.

The Code

This user script runs on all WeightWatchers.com pages, although it really does its thing only on the Site Requirements page. It parses the URL of the current page and replaces it with the actual home page that Weight Watchers takes you to when running an inferior browser.

Save the following user script as weightwatchers.user.js:

 // ==UserScript== // @name WeightWatchers SiteRequirements Bypass // @namespace http://docs.g-blog.net/code/greasemonkey // @description Move past Weight Watchers' ridiculous browser check // @include http://weightwatchers.com/* ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

The Joy of JavaScript

The Joy of JavaScript

Luis Atencio
Ruby by Example

Ruby by Example

Kevin C. Baird
What Successful Project Managers Do

What Successful Project Managers Do

W. Scott Cameron, Jeffrey S. Russell, Edward J. Hoffman, Alexander Laufer
How to Overcome a Power Deficit

How to Overcome a Power Deficit

Cyril Bouquet, Jean-Louis Barsoux

Publisher Resources

ISBN: 0596101651Errata Page