I would like to intercept the user whenever they enter a page with a URL that contains a certain RegEx. Right now, on a background script, I can use:
chrome.webNavigation.onBeforeNavigate.addListener(function (details) {
chrome.tabs.update(details.tabId,{url: chrome.extension.getURL('popup.html')}, undefined);
}, { url: stopit });
Where the array stopit holds JSON objects all of the form:
{urlContains: "regex.x"}
This works great when the user navigates to a new site and uses the bar at the top of the browser. What this DOESN'T cover is when a user navigates to a new page within the same site. Say, for example, the user loads up the reddit home page with the url bar. When they go to subreddits, the url changes and may now contain the Regex. How would I go about checking the url on such an event?
question from:
https://stackoverflow.com/questions/66058224/catch-url-change-within-site-chrome-extension 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…