0
大家好我計劃用window.history.pushState在我的網站,但我有一點知識如何做到這一點..更新內容,更改URL,而無需加載window.history.pushState
我想要的頁面是,我有一個頁面dashboard.php並希望將網址更新爲dashboard.php?做=編輯&誰=我與負載ID contentdiv股利不加載整個頁面....我知道這可以通過此代碼完成
function processAjaxData(response, urlPath){
document.getElementById("content").innerHTML = response.html;
document.title = response.pageTitle;
window.history.pushState({
"html":response.html,
"pageTitle":response.pageTitle}, "", urlPath);
}
window.onpopstate = function(e){
if(e.state){
document.getElementById("content").innerHTML = e.state.html;
document.title = e.state.pageTitle;
}
};
但我不知道如何實現這個功能的迴應。
而且我想如果瀏覽器不支持此則在這種情況下,這應該像一個鏈接,並刷新頁面,可能是確定
任何想法/幫助表示讚賞