History.pushState and page refresh History.pushState and page refresh javascript javascript

History.pushState and page refresh

This does require the server-side support. The ideal use of .pushState is to allow URLs from JavaScript applications to be handled intelligently by the server.

This could be either by re-serving the same JavaScript application, and letting it inspect window.location, or by rendering the content at that URL on the server as you would for a normal web application. The specifics obviously vary depending on what you're doing.

You need to perform server side redirection for copy and pasted fake URLsIt all depends on what server side technology you're using. There is no JavaScript way but writing a crazy function in your 404 page that redirect user based on incoming URL that is not a good solution.

The the user refreshes the page, but the URL of course does not exist on the server

What do you mean by this? I have a feeling your assumption is wrong. Actually yes, the point is it is the developer who should provide (serverside or clientside) implementation of url-to-pagestate correspondence.

If, once again, I've get the question right.