Search code examples
google-chromemicrosoft-edgechromium

Target named on href links no longer seem to open in named tab (Chrome)


Perhaps it's been broken for a while, but I recently noticed named target links no longer open in the same tab.

<a href="www.link.com" target="name">text</a>

Each time the link is clicked, it now opens in a new tab, not the named tab.

I can't seem to find anything about this change, but I suppose this is a very old legacy feature that probably doesn't get a great deal of use these days.

(It still works fine in Mozilla Firefox)


Solution

  • I try to test the code and it works fine on my side.

    In my JS code, I have opened the new tab and set its name as test_window.

    Now, when I click the link, it opens in test_window.

    Sample code:

    <!DOCTYPE html>
    <html>
       <head>
          <title>test</title>
          <script>
             
           window.open("page3.html", "test_window");
          </script>
       </head>
       <body>
          <h1>This is page-1</h1>
          <a href="page2.html" target="test_window">Visit Page-2 by clicking this link...</a>
       </body>
    </html>
    

    Output in MS Edge:

    enter image description here

    Output in Google Chrome:

    enter image description here