0

I am using Facebook connect to let users login to my website, which is developed in PHP.

For login, I get the "Login with Facebook" perfectly and once logged in through their facebook account, the users are taken to another page, which displays some data. But, if someone presses the back button on the browser, it takes him to the previous page(basically the login page) and he can see a "Log in" button again with a facebook symbol besides it, even though the user is already logged in. I am not sure how to get out of this.

Can anyone tell me how this can be solved? I do not want users to press the back button on the browser and see the "Log in" Button once again.

askmish
  • 6,464
  • 23
  • 42

1 Answers1

0

Maybe it is because when you click on the back button, the browser does reload the page from it's cache, not from the server. You can control this cache with the "Cache-Control" http response header. Ex :

<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>

similar question : Force Firefox to Reload Page on Back Button

php header : http://php.net/manual/en/function.header.php

Community
  • 1
  • 1
baraber
  • 3,296
  • 27
  • 46
  • 1
    To expand your answer, here's a nice [article](http://blog.55minutes.com/2011/10/how-to-defeat-the-browser-back-button-cache/). – Matt Aug 02 '12 at 20:10