0

I want to do that when I clicked on link (for example test.com/page?=test) my tab in the broswer open the link but without reload or refresh the page and change the content to the page content.

How can I start it? I know PHP, but its the first time that I try to do this.

Ben
  • 9
  • 8
  • 2
    Possible duplicate of [Modify the URL without reloading the page](https://stackoverflow.com/questions/824349/modify-the-url-without-reloading-the-page) – Kukic Vladimir Jul 09 '17 at 09:42

2 Answers2

0

You can use HTML5 History API

document.body.addEventListener('click', function(event){
    if(event.target.tagName === 'A'){
       event.preventDefault();
       history.replaceState({}, "Page Title", event.target.href);
    }
})
Skribja
  • 161
  • 1
  • 5
0

Well, i doubt there is any easy way for this. https://www.w3schools.com/xml/ajax_intro.asp This might help.

Klajdi
  • 337
  • 1
  • 10