The issue you are experiencing with your Edge extension's side panel showing the same data for all tabs can be resolved by setting the tabId
property in the chrome.sidePanel.setOptions()
method to the tabId
of the current tab. This will ensure that the side panel is specific to the current tab and does not show the same data for all tabs. Here is an example code snippet that demonstrates this:
chrome.tabs.onUpdated.addListener(async (tabId, info, tab) => {
if (!tab.url) return;
const url = new URL(tab.url);
await chrome.sidePanel.setOptions({
tabId,
path: 'sidepanel.html',
enabled: true
});
});
Make sure to also include the "tabs"
permission in your extension's manifest file to allow access to the chrome.tabs
API.
References: