echo "<script type='text/javascript'>n";

function loadUrl(url) {
    console.log("loading data from url: " + url);
}

function push(url) {
    history.pushState(null, null, url);
    loadUrl(url);
}

window.onpopstate = function(event) {
    console.log("history changed to: " + document.location.href);
    loadUrl(document.location.href);
}

echo "</script>";