Change URL without refreshing

/ Published in: JavaScript
Save to your folder(s)

//You cannot change the whole url without redirecting, what you can do instead is change the hash.

//The hash is the part of the url that goes after the # symbol.
//That was initially intended to direct you (locally) to sections of your HTML document, but you can read and modify it through javascript to use it somewhat like a global variable.

Copy this code and paste it in your HTML
  1. document.location.hash = "show_picture";


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.