I’m essentially building the concept of “go-links”, where the (Chrome) user can type something like “go/roadmap” into their URL bar, a Chrome extension will notice that this is a go-link since it starts with “go/”, then do a lookup to see which real URL the “roadmap” go-link should point to.
I’ve found an example online here for how to do this with manifest version 2. It seems that Google is now really recommending version 3.
From what I’ve gathered so far, version 3 doesn’t allow the use of something like webRequest.onBeforeRequest
and instead makes you use declarativeNetRequest. With this framework, I believe my rule would look something like this:
{
"id": 1,
"priority": 1,
"action": { "type": "redirect", "redirect": { "url": "????" } },
"condition": { "urlFilter": "||go/*", "resourceTypes": ["main_frame"] }
}
Question 1: what to put in the “url” value that would allow me to run some JS in my extension to look up what the right URL is (in my case, this would involve an API call to a backend service I have running).
Question 2: would the urlFilter "||go/*"
correctly catch when the user types something like “go/blah” into the URL bar?