簡體   English   中英

有什么方法可以在不加載的情況下在給定的 href 鏈接上重定向我的頁面

[英]Is there any way to redirect my page on given href link without loading

這是我的 html

<a href="http://127.1.1.0:8001/gembead/emstones.html?car=36">Car</a>

基本上我想用參數重定向到這個頁面,但我不希望我的頁面加載。 我怎樣才能做到這一點。 我相信會有一個解決方案。

試試這個(+信息在這里):

 function withoutLoading(url) { window.history.replaceState(null, null, url); }
 a { cursor: pointer; }
 <a onclick="withoutLoading('/gembead/emstones.html?car=36')">Car</a>

如果您想在不重新加載當前頁面的情況下重定向到新鏈接,則必須在按鈕或錨選項卡的 onclick 事件上使用window.hostory.push('url')window.hostory.replace('url') .

暫無
暫無

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

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