[英]customize url when user wants to reload the page
我正在節點js項目中工作。 使用從server.js文件中重定向的頁面到頁面。 我已經使用window.history.pushState("","","custom.url.testing/taslim");
手動定制了URL window.history.pushState("","","custom.url.testing/taslim");
從html頁面腳本。
現在的問題是,當用戶重新加載頁面時,它顯示cannnot get /custom.url.testing/taslim
。
在瀏覽器中按下重新加載按鈕后,如何在重新加載操作之前自定義url?
然后使用
$(document).ready(function(){
});
該網址。
您需要更新node.js服務器以處理所有自定義URL,並返回與您希望用戶加載的路由相同的路由。
這可能意味着您設置了通配符規則,以便具有/custom.url.testing/*
都將加載相同的代碼。
這可能看起來像
app.get("/custom.url.testing/*", function(req, res, next){
// same as whatewer your default route is
next();
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.