簡體   English   中英

如何防止帶有查詢字符串的錨點重新加載頁面

[英]How to prevent anchor with query string from reloading page

當 URL 中包含查詢字符串時,如何防止錨點重新加載頁面。 下面是在直接重定向到部分之前重新加載頁面的鏈接。

<a href="https://iamhoste.com/experiences/?in-home-chef-experiences/#explore">Explore Experiences</a>

單擊此鏈接重新加載頁面,然后重定向到部分 (#explore)。 無論如何我可以防止重新加載。

 <section id="explore">... </section>. . . <div> <a href="#explore">The section you want to explore</a> </div>
這可以幫助您跳轉到您想要的部分,而無需重新加載任何頭痛

在錨標簽中添加一個'target'屬性並在其中寫入“_blank”,例如:target =“_blank”

在您的情況下: <a href="https://iamhoste.com/experiences/?in-home-chef-experiences/#explore" target="_blank">Explore Experiences</a>

據我所知,這應該有效

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM