I am working on a Chrome extension which takes URL parameters as input on an initial page load and then uses them later for additional processing. The problem I'm facing is that the initial URL which contains the parameters I need immediately returns a 302 and redirects to another page.
I have tried both content scripts (with "run_at": "document_start") and a service worker listening on chrome.tabs.onUpdated, but both of them only execute after the redirect occurs. Is there a way to ensure a script can be triggered immediately when a URL is accessed before it redirects?
To summarize, the flow is basically:
- User navigates to
example.com/start?paramKey=paramValue<- This is the URL param that I want example.comreturns a 302 and loadsexample.com/continuewithout URL parameters <- This is where my scripts are currently executing
If I set my content script matcher or host permissions to just match example.com/start* it never triggers. Setting it to match example.com/* only triggers once example.com/continue loads.