链接在新窗口中打开,即使带有 _self 目标标签

问题描述 投票:0回答:0

我正在尝试使用页面顶部的联系按钮创建锚链接https://www.psafinancial.com/john-rast/ 但它一直打开到新选项卡。该按钮在 php 模板中进行控制。

现在设置为,

<a href="#producer" target="_self" class="btn btn--yellow mt-3 d-md-inline-block">Contact</a>

如果我将 href 设置为实际的 url,

<a href="https://www.psafinancial.com/john-rast/#producer" target="_self" class="btn btn--yellow mt-3 d-md-inline-block">Contact</a>

然后链接确实停留在同一页面上。但是,此模板用于多个网址,因此我不能使用直接网址链接。

我缺少什么才能让锚链接留在同一页面上?

php hyperlink anchor
© www.soinside.com 2019 - 2024. All rights reserved.