简体   繁体   中英

customize url when user wants to reload the page

I am working in a node js project. going page to page using redirect from server.js file. I have manually customized url using window.history.pushState("","","custom.url.testing/taslim"); from html page script.

Now the problem is when ever user reload the page it shows cannnot get /custom.url.testing/taslim .

how can I customize url before reload operation after pressing reload button in browser?

Then use

    $(document).ready(function(){

    });

for that url.

You need to update your node.js server to handle all your custom urls, and return the same as the route you want your user to load.

This might mean that you set up a wildcard rule so that anything with /custom.url.testing/* will load the same code.

this would probably look like

app.get("/custom.url.testing/*", function(req, res, next){
  // same as whatewer your default route  is
  next();
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM