0

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?

2 Answers 2

5

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.

Sign up to request clarification or add additional context in comments.

Comments

0

Change it to:

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.