![](/img/trans.png)
[英]Is there a way to disable href link / links if the user is already on the page the href link / links leads to, without using JQuery?
[英]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.