Last active
February 26, 2024 18:52
-
-
Save eliashussary/dfe8d0332561ee25b2b0614331f2df0e to your computer and use it in GitHub Desktop.
chrome webrequest onBeforeRequest example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
// Use of this source code is governed by a BSD-style license that can be | |
// found in the LICENSE file. | |
// Simple extension to replace lolcat images from | |
// http://icanhascheezburger.com/ with loldog images instead. | |
chrome.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: [ | |
"https://i.chzbgr.com/*" | |
], | |
types: ["image"] | |
}, | |
// extraInfoSpec | |
["blocking"] | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hey
how can i get header request before send
pls simple exm if u can
tnx