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

Side by Side 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: comment 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <script src="loldogs.js"></script>
2 <script>
3 // Simple extension to replace lolcat images from
4 // http://icanhascheezburger.com/ with loldog images instead.
5
6 chrome.experimental.webRequest.onBeforeRequest.addListener(
7 function(info) {
8 console.log("Cat intercepted: " + info.url);
9 // Redirect the lolcal request to a random loldog URL.
10 var i = Math.round(Math.random() * loldogs.length);
11 return {redirectUrl: loldogs[i]};
12 },
13 // filters
14 {
15 urls: [
16 "http://icanhascheezburger.files.wordpress.com/*",
17 "http://chzmemebase.files.wordpress.com/*",
18 ],
19 types: ["image"]
20 },
21 // extraInfoSpec
22 ["blocking"]);
23 </script>
Boris Smus 2011/08/19 19:12:35 Since this is a public sample, can we make this pa
Matt Perry 2011/08/19 20:04:51 I don't think we should try to assert that backgro
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698