Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7200)

Unified Diff: chrome/common/extensions/docs/examples/extensions/catblock/background.html

Issue 7621076: Add a sample webRequest extension. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: doctype Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698