After reviewing the website you submitted, I was able to find a JavaScript file, which as many people suggested uses Ajax to load the contents into the page without reloading it, after the webpage is loaded, the script triggers a hash change, which changes the URL to match the one you clicked on using window.history.pushState()
as suggested by @escapedcat, the JavaScript also handles the animation and changes the classes of certain elements in the webpage to reflect its state (updating, etc.).
The code is uglified, but you can still see how this is done:
link
Edit:
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Page 1</title>
</head>
<body>
<header>
<nav><a href="page.html">Link</a></nav>
</header>
<div id="content">
this is the default content
</div>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<script type="text/javascript">
$('nav a').on('click', function(e){
e.preventDefault();
console.log('test');
$.get(this.href, function(data){
$('#content').html(data);
console.log(this);
history.pushState({foo:'bar'}, 'second page', 'page.html');
});
});
</script>
</body>
</html>
page.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Page 2</title>
</head>
<body>
This is page 2
</body>
</html>
The above changes the URL, you still have to do further development of the code to get full functionality, i.e. a back button.
You can refer to Page not reloading via 'back' when using pushState() / onpopstate to add this kind of functionality.
Edit:
The pushState()
method:
As the documentation states, the pushState()
method receives 3 arguments:
a state object containing serialized information associated with the
new history entry,
the page title, and
the page URL.
Each time a user navigates to a new history entry, the popstate
method is fired and the state changes to represent the current state.