Skip to content

Instantly share code, notes, and snippets.

@davlgd
Last active September 5, 2018 14:48
Show Gist options
  • Select an option

  • Save davlgd/712db58e9556555cf9015994dfa155fd to your computer and use it in GitHub Desktop.

Select an option

Save davlgd/712db58e9556555cf9015994dfa155fd to your computer and use it in GitHub Desktop.
Bad Search Engine Blocker - Script (étape 3)
chrome.webRequest.onBeforeRequest.addListener(function (request) {
const askedURL = new URL(request.url);
const keywords = askedURL.searchParams.get("q");
const destinationUrl = (keywords) ? "https://www.framabee.org?q=" + keywords : "https://www.framabee.org";
return { redirectUrl: destinationUrl };
},
{ urls: ["https://*.google.com/*"] }, ["blocking"]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment