0

there question is how to get http status code of newly created tab without fetch/XMLHttpRequest?

I tried with

  browser.tabs.onUpdated.addListener(function (tabID, changeInfo, tab) {
    console.log(changeInfo)
    if (tabID === tabId && tab.status === 'complete') console.log(tab)
  })

but it doesn't return any error status

  • 1
    It looks like you can't, as [this answer shows](https://stackoverflow.com/questions/220231/accessing-the-web-pages-http-headers-in-javascript). I know that's about regular web pages, but a good rule of thumb is when there's no explicit extensions API, try the web one. I tried playing around with the [Headers API](https://developer.mozilla.org/en-US/docs/Web/API/Headers) in an extension page (really just assuring myself that it works the way I think). I'm not sure of any of this, which is why I'm answering in a comment. – StormyKnight Oct 24 '22 at 15:45
  • 1
    You can use browser.webRequest API. – wOxxOm Oct 24 '22 at 17:06

0 Answers0