Skip to content

Commit a89d748

Browse files
committed
Fix URL display after redirects
When navigating to a page that redirects (e.g., auth refresh URLs), the extension captured the redirect URL instead of the final page URL. Added webNavigation.onCompleted listener that updates the stored URL to the final destination after all redirects complete.
1 parent 07bab9b commit a89d748

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

CF Cache Status/CF Cache Status Extension/Resources/background.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,16 @@ browser.webNavigation.onBeforeNavigate.addListener((details) => {
183183
}
184184
});
185185

186+
// Update URL after navigation completes (handles redirects)
187+
browser.webNavigation.onCompleted.addListener((details) => {
188+
if (details.frameId === 0) { // Main frame only
189+
const data = tabData.get(details.tabId);
190+
if (data && data.url !== details.url) {
191+
data.url = details.url; // Update to final URL after redirects
192+
}
193+
}
194+
});
195+
186196
// Capture response headers for main document requests
187197
browser.webRequest.onHeadersReceived.addListener(
188198
(details) => {

0 commit comments

Comments
 (0)