CodeIgniter Forums
How to refresh page when back button of browser is clicked - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to refresh page when back button of browser is clicked (/showthread.php?tid=53209)

Pages: 1 2 3


How to refresh page when back button of browser is clicked - El Forum - 07-30-2012

[eluser]CroNiX[/eluser]
[quote author="rei" date="1343571225"]Thank you very much sir! I really appreciate your time in helping me Smile

I cant believe it solved my problem. The browser now reloads when I click the back button in FireFox, Chrome, IE7 to 9. However the problem still exists in opera mini browser. Damn. But stil thank you very much! Smile

Based on my research cache expirations still depends on the browser if they want to follow the instruction. FF, Chrome, IE7-9 follows it. Only Opera mini doesn't. Safari not tested yet[/quote]
Welcome to the wonderful world of web development, where no one (browser manufacturers) follows standards so we have messes like this.

I wouldn't worry too much about if it works in Opera. No one uses it, or very few. Certainly not enough to justify spending time (money) getting things to work in it, imo. At least none of my clients want me wasting time on it.


How to refresh page when back button of browser is clicked - El Forum - 07-30-2012

[eluser]rei[/eluser]
Yes it is frustrating :/ tsk.

Nwei sir I can't ignore the problem because, It will break the logic of the online exam system that I'm planning to build. Because questions must be shown to the user 1 at a time and the user is not allowed to go back to the previous questions.


How to refresh page when back button of browser is clicked - El Forum - 08-07-2012

[eluser]Unknown[/eluser]
$this->output->set_header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
$this->output->set_header("Last-Modified: " . gmdate("D, d M Y H:iConfused") . " GMT");
$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
$this->output->set_header("Cache-Control: post-check=0, pre-check=0", false);
$this->output->set_header("Pragma: no-cache");

Where should i put this code?


How to refresh page when back button of browser is clicked - El Forum - 08-07-2012

[eluser]rei[/eluser]
You can put it in the constructor of your controllers.


How to refresh page when back button of browser is clicked - El Forum - 11-06-2013

[eluser]Unknown[/eluser]
Dear Rei,

Could you please elaborate on how to put it in the constructor of the controllers please? Thank you.