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.
Please go to the main page and install the latest version.
The current version of this page is Transformations.
The transform javascript is executed by GlimmerBlocker and not by Safari. The script is never sent to Safari but only the result of running the script inside the GlimmerBlocker proxy.
How the transformation works:
Please look at the html samples. Please look at the feedburner rule for an xml example.
To make detecting errors in transformation Javascripts much faster check the "Show transform javascript errors" option in the advanced/debugging section.
replace(/regexp/, "some text"); // is a shorthand for: t = t.replace(/regexp/, "some text");
gb.zapScriptElements(); // removes all <script>..</script> elements from t. gb.zapStyleElements(); // removes all <style>..</style> elements from t. gb.zapIframeElements(); // removes all <iframe>..</iframe> elements from t. gb.addScriptElement(contents); // Adds a <script>contents</script> element in t just before the </body> tag // (i.e. end of document). gb.addStyleElement(contents); // Adds a <style>contents</style> element in t just before the </head> tag // (i.e. end of header so it overrides loaded stylesheets). gb.setDocumentTitle(txt) // Updates the <title>...</title> element with the new text. // The argument is automatically html-encoded, // so you don't need to care about <, > and &. gb.log("I had %d birds and a %s dog", 42, "black"); // Logging to the console (use the "Open Log" button on the advanced tab). // The first parameter is a format string just like console.log() in Firebug: // %s: string // %d: decimal (no formatting yet) // %f: floating point (no formatting yet) var html = gb.htmlEncode("Paul & Allan. 1 < 2"); // Encodes some text as html. The example returns "Paul & Allan. 1 < 2" var js = gb.jsEncode(s); // encode a string to be a Javascript string token: // gb. jsEncode(null) -> "null" // gb. jsEncode("Hello, D'Angleterre") -> "'Hello, D\x27Angleterre'" // OBS: the result includes single quotes. var ss = gb.urlEncode(s); // encode a string with %-escapes. Similar to escape() and encodeURIComponent() in browsers. // gb.urlEncode("Hello, D'Angleterre") -> "Hello%2C%20D%27Angleterre" gb.insertAtHeadStart(contents); // Inserts the contents just after the <head> tag. // Useful for adding <meta..> tags. gb.insertAtHeadEnd(contents); // Inserts the contents just before the </head> tag. // Useful for adding external stylesheets, scripts, etc. gb.insertAtBodyEnd(contents); // Inserts the contents just before the </body> tag. // Useful for adding external scripts, etc. var hostPrefix = gb.attachmentDownloadHostPrefix(); // returns a "download as attachment" servlet prefix. // The servlet takes two parameters: // 1) url: the absolute URL of the file to download. // 2) filename: the filename which Safari should use. // The servlet fetches the content at the URL and forwards it to Safari, but adds // a "content-disposition" header so the file always is downloaded as an attachment. // The servlet checks the content-type header sent by the server and changes the filename to match it. // The reason for using a host prefix instead of a static domain such as 'glimmerblocker.test' is // to have Safari send the cookies for the download domain. // See YouTube download filter for example. a.href = "http://" + hostPrefix + ".example.com" + "?url=" + escape("http://example.com/thingy.flv") + "&filename=" + escape("weird-movie.suffix"); // The prefix is unique for each GlimmerBlocker installation.
The content is stored in the global variable t. The name is as short as possible to unweildly long lines.
GlimmerBlocker provides utility functions and information in the global gb variable.
Each rule uses its own global scope in Javascript, so a script is not able to see nor modify variables used by other rules. For performance reasons the last 25 executed scripts are cached: the compiled version of the script and the its scope (i.e. global variables). There is no support for persistence or network operations whatsoever.
GlimmerBlocker uses the Rhino Javascript runtime with the language level set to 1.7
The detailed execution steps are: