JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-beta1/jquery.min.js"></script>
<div class="container">
</div>
<button id="test">
test
</button>
JavaScript
$( document ).ready(function() {
$('#test').click(function() {
alert('pushstate');
$('.container').html('ajax contents');
window.history.pushState({'path': 'www.google.com'}, "test", $(this).href);
});
window.onpopstate = function(event) {
alert('popstate: your path is ' + event.state.path);
$('.container').load(event.state.path);
};
});