Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to disable BACK button of the browser?

 
Abhilash Etikala
Ranch Hand
Posts: 38
Java MySQL Database PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,
In my application i am having a online exam which contains a startpage.php and in that start page whenever a user clicks on the link provided the exam starts..(The exam page consists of two frames top and bottom)Top frame is for displaying time running and bottom frame is for exam questions are displayed).
So ,whenever user starts the exam the exam page is displayed the timer starts and questions are displayed in the bottom frame but when the user clicks BACK button of the browser again the startpage.php is displayed and he can again restart his exam on clicking the link which should not happen.

I TRIED:
first time when user starts the exam by clicking the link in startpage.php i initialized a SESSION variable and again for everytime the user enters startpage.php iam checking the session variable whether it is initialized or not.If it is initialized then it means the exam had already started so iam redirecting to error page if not initialized the exam starts.
What i tried is working if i try to open the startpage.php in another tab of the same browser after once he started the exam but it is not working if i click BACK button...
And correct me if my approach is not correct??
any suggestion ??? Thanks in advance...
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The back button does pulls the page from the cache and not the server. You need to set no cache headers.

Eric
 
Abhilash Etikala
Ranch Hand
Posts: 38
Java MySQL Database PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric Thanks for reply..
I tried to clear cache using meta tag:
But still not working Is the above is correct?? and how to clear the cache other than <meta> tag...
Thanks in advance...
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you clear your cache before trying?

How are the people getting to the 2nd page?

Eric
 
Abhilash Etikala
Ranch Hand
Posts: 38
Java MySQL Database PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya.. i cleared startpage.php using

header("Cache-Control: no-cache");
header("Pragma: no-cache");

on clicking the link it is redirected to exam page...where the exam starts....
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you actually clear YOUR cache. Manually remove the files.

Eric
 
Abhilash Etikala
Ranch Hand
Posts: 38
Java MySQL Database PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya i cleared manually...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic