Welcome Guest, Not a member yet? Register   Sign In
How to refresh page when back button of browser is clicked
#11

[eluser]InsiteFX[/eluser]
You cannot do it with PHP, this is why it is browser specific.

You might be able to do it using the DOM, but I am not going to get into that.

Search Google and you will find out that this is not so easy to do.
#12

[eluser]rei[/eluser]
Yes its very difficult to find the right solution for my problem :/ been stuck with this problem for a long time :/ I wonder how facebook always shows fresh content, if you try pressing back button in facebook you will see in the browser that it reloads the page even if I try to turn off the javascript in my browser.
#13

[eluser]InsiteFX[/eluser]
because they use js turn off js and see if it works.

do a page view source
#14

[eluser]rei[/eluser]
I already tried turning off javascript last time but facebook still loads fresh content when you click the back button you will see the page reloads. Now I tried it again and it still reloads the page. I also found a online exam system in the internet that displays 1 question at a time and when you press back button even when javascript is turned off it will display the current question, but when I used opera mini it redirects me to the home page but that is not a problem because when I press the button take exam it will redirect me to the current question. I tried all of that when the javascript is turned off in the browsers. I really dont have an idea how they did that. Many developers said that I need to set the session no store in the header. I already tried their solutions but still no luck. When I'm using their solution and I press the back button the page will say page has expired in firefox but in opera mini and chrome it still loads the previous questions. This problem is really frustrating :/
#15

[eluser]InsiteFX[/eluser]
Try this one:
Code:
$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:i:s") . " 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");
#16

[eluser]rei[/eluser]
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
#17

[eluser]Unknown[/eluser]
Dam... even I would be interested in know how to solve the problem. My friend, I already tried to look for some solutions but failed. I will try and look on how the Drupal Quiz module handles it and will get back to you.
#18

[eluser]rei[/eluser]
Thanks Smile I would really appreciate when you share to this thread the solution once you find a working solution for this problem because it will really help many other developers because I've seen so many people asking a solution for this back button problem. I will also share the solution here once I found a working solution for this problem Smile
#19

[eluser]InsiteFX[/eluser]
For opera try this one:
Code:
Pragma: no-cache
Cache-Control: no-cache, no-store
Expires: 0

$this->output->set_header("Pragma: no-cache");
$this->output->set_header("Cache-Control: no-store");
$this->output->set_header("Expires: 0");

Means you would need to check the useragent to see
#20

[eluser]rei[/eluser]
It didn't solved the problem on opera mini sir. hmmm




Theme © iAndrew 2016 - Forum software by © MyBB