1

Is there a way to open a link in a WebExtension sidebar to the currently active tab? I don't want to automatically open the link in a new tab. I'm talking about regular links:

<a href="https://www.example.com">Example</a>

Things I've tried:

  • Adding any target value to the a element does not seem to have the desired effect for any value.
  • Calling window.location.replace opens the link in the sidebar instead of the currently active tab.
  • Getting the current tab by using browser.tabs.query and setting tab.url for the sole result does nothing (even though I have added the tabs permission to manifest.json).

At this point, I'm kind of thinking this might not be possible. Is this the case?

Xiyng
  • 327
  • 1
  • 5
  • 16
  • Use browser.tabs.update – wOxxOm Mar 21 '22 at 04:47
  • @wOxxOm Somewhat surprisingly that actually works. Thanks! If you'd like, you could post this as an answer instead, so I could accept it. – Xiyng Mar 22 '22 at 02:13
  • There's an [existing answer](https://stackoverflow.com/questions/1891738/how-to-modify-current-url-location-in-chrome-via-extensions) for `chrome`, but it's conceptually the same. – wOxxOm Mar 22 '22 at 05:38

0 Answers0