Is it possible to make dictionary links reuse the same tab?

anki 2.1.54 windows 10

I was wondering if someone already worked on or seen something similar.
I created some clickable icons that link to dictionaries. I need to open the dictionary very often. A new tab is opened every time I click a word. I tried using the same name for the target attribute, but it didn’t work. I tried some javascript but it also didn’t work. although both methods work when I create an ordinary webpage.
I know the docs say that it’s not possible to provide help writing javascript. I was wondering if someone has already done it.
here’s my html block for example:

<span class="icon-bar">

<a class="favicon-link" href="``https://de.wiktionary.org/wiki/{{text:Word}``}" target="\_blank" rel="noopener">

<img class="favicon-img" src="``https://upload.wikimedia.org/wikipedia/commons/thumb/c/c3/Wiktfavicon_en.svg/64px-Wiktfavicon_en.svg.png``" alt="open" />

</a>

</span>

Is it possible to make dictionary links reuse the same tab?

I don’t think so. Browsers do not expose their inner variables, such as tab ids, to outside processes. You can probably write a Firefox/Chrome extension and make it serve as a bridge between Anki cards and the browser, but that will probably take quite a bit of work for such a small feature.

Alternatively, you could put an <iframe> on your card and use it to open external webpages inside Anki itself. Just use a JS to modify its src attribute instead of using an <a> tag for opening links, and style it like a side panel/tab inside your card.

If you don’t need heavy editing of the cards during the reviews, you could also do them from AnkiWeb in your browser. This way, JS on your cards will have access to previously opened tabs if you save the result returned by window.open and reuse it by changing the .location.href value.

4 Likes