我嘗試更改頁面的網址而無需重新加載頁面。如果我嘗試在控制檯URL這個變化:更改網址而無需重新加載頁面
if (localStorage.getItem('product') !== null) {
storedVariable = localStorage.getItem('product');
url = window.location.href;
url += '?product=' + storedVariable;
}
window.history.pushState("", "", url);
但是,當我把這個代碼到谷歌標籤管理器我的網頁的URL是默認的。我該如何解決它?
http://stackoverflow.com/a/12446376 – Piggy