Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bad Search Engine Blocker - Projet final
chrome.webRequest.onBeforeRequest.addListener(function (request) {
const askedURL = new URL(request.url);
const keywords = askedURL.searchParams.get("q");
if (/bing.|google.|yahoo./.test(askedURL.hostname))
{
const destinationUrl = (keywords) ? "https://www.framabee.org?q=" + keywords : "https://www.framabee.org";
return { redirectUrl: destinationUrl };
}
},
{ urls: ["<all_urls>"] }, ["blocking"]);
{
"manifest_version": 2,
"name": "Bad Search Engine Blocker",
"description": "Une extension pour bloquer les moteurs de recherche qui ne respectent pas la vie privée",
"version": "0.1",
"permissions": [
"webRequest",
"webRequestBlocking",
"<all_urls>"
],
"background": {
"scripts": ["background.js"]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment