I am trying to build a simple chrome extension that will block a list of websites. At the moment I have this:
function logURL(requestDetails) {
console.log("Loading: " + requestDetails.url);
alert(1);
}
chrome.webRequest.onBeforeRequest.addListener(
logURL,
{urls: ["*://*.google.com/*"]}
);
When I go to google I get an alert. When I close the alert I get another one and another one and they keep coming.
When I take out the
alert(1);
I don't get any alerts but I also do not get any console logs which I would expect.
Any ideas?
P.S I'm a junior developer and just learning so apologies if this is really simple, I would appreciate a detailed reply as it will help me develop my skills.