Ken
Ken

Reputation: 13

manage the "previous " button of the browser in cakephp

I am working on a cakePHP application. when the user is disconnected and the login page is displayed, if the user click on the back button of the browser, the previous page is always displayed. how to disable it in cakephp ?

Thanks

Upvotes: 1

Views: 991

Answers (2)

IWillScoop
IWillScoop

Reputation: 258

If you want to prevent that then you can disable caching by placing this on your AppController

2.X:

$this->response->disableCache();

3.X:

Cache::disable();

Upvotes: 0

Michel
Michel

Reputation: 1165

In app/Config/core.php uncomment line 158, that will give you this:

Configure::write('Cache.disable', true);

Then in your controller function put this:

$this->disableCache();

E.g:

public function pageName(){
 $this->disableCache();

}

Upvotes: 1

Related Questions