Dia
Dia

Reputation: 37

How to manipulate the back button of a browser

What I am trying to do is to change the link of the back button of a browser. For example I want to go 2 pages behind, not only one.

Upvotes: 0

Views: 887

Answers (2)

Dia
Dia

Reputation: 37

I didn't manage to manipulate the back button as the people above have said. What i did, was to use some javascript after my job was done. This is my code in php:

print "<script>window.history.go(-2); </script>";

Simple but it does its job!

Upvotes: 0

WGH
WGH

Reputation: 3499

You can manipulate the history with JavaScript History API. I'm not sure that it's possible to actually make "Back" button go two pages back, though, but the API is pretty flexible so you might be able to work around your original problem.

Upvotes: 2

Related Questions