Retrieving meta tags from sites like youtube and twitch

Hi all,

I’ve been working on an extension where on page load i send a message to my devtools panel where i look at the DOM, retrieve all meta tags and then show them in the dev panel.

This already works for most sites except for some like youtube and twitch. These sites seem to only update their meta tags after i reload the page manually. Therefore i added a url check in my background script that reloads the tab automatically. (see below)

browser.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
  if ("complete" === changeInfo.status) {
browser.runtime.sendMessage({ tabId, action: "refresh" });
if (
  changeInfo.url &&
  (changeInfo.url.includes("youtu") || changeInfo.url.includes("twitch"))
) {
  browser.tabs.reload();
}
  }
});

of course this isn’t really as user friendly as i would like. Therefore i was wondering if any of you encountered something like this before and how you went about it.

If not i was thinking of adding a button in a browser action that let’s the user enable or disable the add-on.

1 Like