Index: chrome/common/extensions/docs/examples/extensions/catblock/background.html |
diff --git a/chrome/common/extensions/docs/examples/extensions/catblock/background.html b/chrome/common/extensions/docs/examples/extensions/catblock/background.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3db992b0473b32cd4e147c1db8a0c8e9bfa52911 |
--- /dev/null |
+++ b/chrome/common/extensions/docs/examples/extensions/catblock/background.html |
@@ -0,0 +1,24 @@ |
+<!doctype html> |
+<script src="loldogs.js"></script> |
+<script> |
+// Simple extension to replace lolcat images from |
+// http://icanhascheezburger.com/ with loldog images instead. |
+ |
+chrome.experimental.webRequest.onBeforeRequest.addListener( |
+ function(info) { |
+ console.log("Cat intercepted: " + info.url); |
+ // Redirect the lolcal request to a random loldog URL. |
+ var i = Math.round(Math.random() * loldogs.length); |
+ return {redirectUrl: loldogs[i]}; |
+ }, |
+ // filters |
+ { |
+ urls: [ |
+ "http://icanhascheezburger.files.wordpress.com/*", |
+ "http://chzmemebase.files.wordpress.com/*", |
+ ], |
+ types: ["image"] |
+ }, |
+ // extraInfoSpec |
+ ["blocking"]); |
+</script> |