Last active
September 10, 2018 08:45
-
-
Save davlgd/b1d63af28be8dc0fe55668d3474b57b0 to your computer and use it in GitHub Desktop.
Bad Search Engine Blocker - Projet final
This file contains hidden or 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
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"]); |
This file contains hidden or 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
{ | |
"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