Change URL in Browser Address Bar

The following script will change the URL in the browser address bar. This includes updating the title and the link.

<script type="text/javascript">
function ChangeUrl(title, url) {
        if (typeof (history.pushState) != "undefined") {
            var obj = { Title: title, Url: url };
        history.pushState(obj, obj.Title, obj.Url);
    } else {
        alert("Browser does not support HTML5.");
    }
}
ChangeUrl("Title", "Link");
</script>


Comments