Patrick Reck
Patrick Reck

Reputation: 11374

HTML5 URL update without refreshing

I've tried to use the HTML5 window.history.pushState function, but i can't quite get it working.

This is the function:

    function changeUrl() {
        window.history.pushState(object, "Title", "?side=annoncer&sletid=1");
    }

And this is the link which should invoke it:

   <a href="javascript:void(0);" onClick="changeUrl();">

What did i do wrong?

Upvotes: 0

Views: 823

Answers (2)

S P
S P

Reputation: 4643

Change it to:

         window.history.pushState(null, "Title", "?side=annoncer&sletid=1"); 

Upvotes: 0

Prog Mania
Prog Mania

Reputation: 624

you don't need to set an object

function changeUrl() {
        window.history.pushState(null, "Title", "?side=annoncer&sletid=1");
    }

check it and it'll work fine.

Upvotes: 5

Related Questions