Hack 78. Bypass Weight Watchers Browser Checker

 < Day Day Up > 

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).

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.


9.3.1. 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/* // @include        http://www.weightwatchers.com/* // ==/UserScript== // based on code by Carlo Zottmann // and included here with his gracious permission if (window.location.href.match(/siteRequirements/i)) {     window.location.replace( location.href.match(/^(https?:\/\/[^\/]+)\//i)[1]+"/index.aspx");     } 

9.3.2. Running the Hack

Before running this hack, go to http://www.weightwatchers.com. The site will immediately redirect you to a page telling you that you are using an unsupported browser, despite listing instructions for Firefox, as shown in Figure 9-3.

Figure 9-3. WeightWatchers.com site requirements


Now, install the user script (Tools Install This User Script), and revisit http://www.weightwatchers.com. Now the Unsupported Browser page redirects to the Weight Watchers home page, as shown in Figure 9-4.

Figure 9-4. WeightWatchers.com home page


As you can see, the site functions perfectly well in Firefox. Note to self: when you start your own company to take over the world, try not to upset 60 million potential customers.

     < Day Day Up > 


    Greasemonkey Hacks
    Greasemonkey Hacks: Tips & Tools for Remixing the Web with Firefox
    ISBN: 0596101651
    EAN: 2147483647
    Year: 2005
    Pages: 168
    Authors: Mark Pilgrim

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net