GlimmerBlocker Logo

GlimmerBlocker

HTTP based ad blocker for Mac OS X

No hacks, no instability
Upgrade Safari whenever you like, no need to wait for an upgraded hack

GlimmerBlocker is no longer maintained and should no longer be used as web sites have migrated from using plain http to using https (i.e. encrypted) which prohibits modification by a proxy unless you resort to install custom SSL certiticates on the client.

You should use a browser extension instead.

It was made as a hobby project during 2007-2008 by Peter Speck. It features both a custom http server and http client and a Mac OS X control panel.

GlimmerBlocker did not only block requests but also allowed for adding custom css and javascript to the pages. It also allowed for modification of the page html before the browser receives the html, which made some modifications much easier than DOM based modifications.

Keyword expansion

GlimmerBlocker supports 2 forms of keyword expansion:

  1. Simple macro-based expansion just like Firefox.
  2. Javascript based expansion.

Macro based expansion

'%s' is replaced by the URI-encoded search term, and '%S' (capital-S) is replaced by the non-encoded search term.

GlimmerBlocker 1.5.0b4 and later: '%t' is replaced by latin-1 encoded search term (%s uses utf-8 encoding).

Example

The template for the 'trailer' keyword is:

http://www.google.com/search?q=site:www.apple.com/trailers/%20%s&btnI=1

When user enters "trailer right one", the template is expanded to:

http://www.google.com/search?q=site:www.apple.com/trailers/%20right%20one&btnI=1

which performs a "I'm Feeling Lucky" search on Google which automatically redirects you to the Apple site. try it

Javascript based expansion

The javascript runtime is very much like that for the Javascript based transformations.

The differences are:

  1. None of the request related variables are defined: gb.contentType, gb.referer, gb.method,
  2. The gb.url and t variables are initialized to null.
  3. The search terms are stored in the gb.term global. An URI encoded form is stored in gb.encodedTerm
  4. The keyword is stored in gb.keyword. This is useful when the rule uses regexp to match multiple keywords.

Your script should either:

  1. Set the gb.url variable. GlimmerBlocker uses the url for a redirect response to Safari.
  2. Or set global variable t. GlimmerBlocker sends its content as html to Safari.

If neither variables are set, GlimmerBlocker proceeds to use the other rules which matches the keyword. The gb.url variable takes precedence over t.

Useful links

  1. The object reference
  2. The request/response flow.
  3. Proxies overview.

Example

The 'stock' keyword expansion have been implemented using Javascript. The code is:

gb.url = "http://host.businessweek.com/businessweek/Corporate_Snapshot.html" +
         "?Symbol=" + gb.urlEncode(gb.term.toUpperCase());

Regexp example

Keyword: java regexp "gg?" using Javascript expansion:

if (gb.keyword == "gg") {
  gb.url = "http://www.google.com/search?q=" + gb.encodedTerm + "&btnI=1";
} else {
  gb.url = "http://www.google.com/search?q=" + gb.encodedTerm;
}

The regexp matches either "g" or "gg". The javascript redirects to a "I'm Feeling Lucky" search when the keyword is "gg" and to a normal Google search when the keyword is "g".