How to receive redirects in Safari extensions

I am developing a safari extension

When a redirect occurs on a web page, I want to detect the redirect and obtain all redirect URLs.

If there is any way, please let me know

Below is what I tried manifest version is 3

1, Use webNabvigation in background.js

browser.webNavigation.onBeforeNavigate.addListener(function(details) {
     console.log("Redirected to:", details.url);
});

This works, but I couldn't get the expected URL

2, Use webRequest in background.js

This resulted in an error as it was not possible to listen to events in a non-persistent background. This is caused by using manifest version 3.

Actually, webNavigation.onBeforeNavigate is not the only problem

webRequest.onBeforeRedirect - also doesn't catch all redirects

For example https://developer.apple.com/forums/thread/735111

webRequest is also does not work properly

How to receive redirects in Safari extensions
 
 
Q