This was working the first time I tried it, would re-use the same tab as target if it exists and create if it does not
<a href="www.example.com/help/section3" target="helpTab" class="helpButton">Help</a>
Later when I tried the link I noticed it was creating new tabs over and over if i clicked it multiple times, and not re-useing that tab it already made.
so I tried using the java window.open:
<a onclick="window.open('http://example.com/help/#section1', 'helpTab'); return false" class="helpButton">Help</a>
and still it keeps opening in new tabs over and over again.
what would cause it to stop working or what am I doing wrong?
I had this issue recently and found two possible reasons that target="helpTab"
might have stopped working:
www.example.com/help/section3
) redirects to another URL, this will prevent the tab from being reused.Cross-Origin-Opener-Policy
HTTP header between the original page and the target page, it can prevent the tab from being reused.In my case, I had only set Cross-Origin-Opener-Policy: same-origin
on the target page. The solution was to also set the same header on the original page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With