Is it possible to track the request initiated by blockingResponse redirection in webRequest?

Hello, everyone.

I am developing an add-on, and I used something like

browser.webRequest.onBeforeRequest.addListener(redirect, someFilter, ["blocking"])

where redirect() is a function which returns a blockingResponse of

return { redirectUrl: "someUrl" };

which will initiate a redirection.

My questions are:
Is there any way to track the request initiated by such redirection, which gives information about possible errors (e.g. timeout, no internet) and HTTP status codes? Or is there some other way to do it around?

Thanks.


You could track errors with webRequest.onErrorOccured and add in the webRequest.RequestFilter the details.tabId from webRequest.onBeforeRequest.

1 Like

Ah, thanks for the reply.

The details.tabId doesn’t suit my purpose here, as multiple requests may happen within the same tab and I need to be specific.

But thank you anyway.

In this case, you could use also details.requestId.

1 Like

I’m trying it. Details.requestId seems good so far.

Thank you very much!