HI WELCOME TO KANSIRIS

Hide URL parameters using HTML/HTML5

Leave a Comment

 Before HTML5 we can use:

parent.location.hash = “hello”;
and:

window.location.replace(“http:www.example.com”);
This method will reload your page, but HTML5 introduced the history.pushState(page, caption, replace_url) that should not reload your page.

Eg: http://www.sampleurl.com?a=1&b=2

apply below code

<script>

window.onload=function(){

history.pushState(www.sampleurl.com?a=1&b=2,null, http://www.sampleurl.com)

}

output:

http://www.sampleurl.com

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.