Thursday, December 19, 2013

Change url without reloading application using javascript

Hello All,

I worked on application which need to change url after loading page because I don’t want to show user to full url.

I can do this by window.location but it will reload our application but I don’t want this also.

Here small code snipt which will done this job.

<script>

        var clean_uri = location.protocol + "//" + location.host + location.pathname;
        window.history.replaceState({}, document.title, clean_uri);

</script>