Force Reload Of Page When User Press "Back" Button

Dec 23, 2001

Is there a way to force a page to reload if a user har pressed the "Back" button in the browser.


Log Users Out And Press The Back Button To Get Back To The Members Page?

Nov 25, 2010

At the top of my login page, I create a session:



To make sure the code is only run if the login function, I set this session to true.Now on members page(once the users log in), before I run any code, I place it in:if($_SESSION['loggedin']){, So this ensures that it will only run if the users have logged in.The user logs in using my form.the members page.Here, they can now log out, which takes them back to the login page.Now in doing this, the session loggedin was false.The reason why, at this point, I wanted to avoid the user being able to press the back button to get back to the members page.

View 3 Replies View Related

Avoid The Message 'warning Page Is Expired, Press Refresh Button To Reload?

Jun 8, 2010

how to avoid the message 'warning page is expired, press refresh button to reload' when we press back button in php.

View 1 Replies View Related

When Press The 'Back" Button Of The Browser Then We Can See The Previous Page With Logged In?

Oct 6, 2008

I wrote the code of a user registration script , everything working fine with out the log out page.... I used the header function to goto the another page when visitor hits "Logout" button. And now the problem is when press the 'Back" button of the browser then we can see the previous page with logged in.

View 3 Replies View Related

Reload The Page On Hitting Back Button?

Sep 5, 2010

I have a webpage that requires login. Once a user has logged in I start the session and once he logs out I destroy it, but when I press the back page it gives me the user profile page again which ideally should not be the case as the user has logged out. However, it works fine if I reload the page after logging out.

It's a local chatroom where everybody online and logged in can chat together. There are three pages: login.php, auth.php, logout.php

login.php is the common login page containg a form. auth.php has a div displaying all previous chats up til now, a textbox and share button on clicking which a form is sent again to auth.php so everytime the form is posted the chatpost is sent to database and auth is reloaded with the latest database within the chat div..

Now the problem is once I logout I unset all the variables and destroy the session but even then if I hit the back button in browser (Safari), the previous version of auth.php without the last chat entry is visible which ideally should not as the session is destroyed. I have put a session validation in auth.php, so basically I want the auth.php to reload of the user visits it after logging out as reloading auth.php displays that "you are not logged in"

i have tried

<?php header("Cache-Control: no-cache");
header("Pragma: no-cache");
<meta http-equiv='Pragma' content='no-cache'>
<meta http-equiv='Expires' content='-1'>

View 2 Replies View Related

Protection Against Page Reload And Back Button?

Nov 12, 2010

Further to my previous question, here's what I decided to implement; it may not be pure P-R-G, but it seems ok. Care to comment? The form.php has an action; let's call it validate.php. validate.php is never seen by the user; if validates all $_GET and, if valid writes it to database and generates the HTML of a confirmation page / if not valid, it generates the HTML of an error page explaining what is wrong.

Whichever HTML is generated get stored in a $_SESSION variable and then validate.php does a header('Location: <as appropriate>); Finally a page called submitted.php of invalid_input.php (in case the user reads the URL) consists only of echo $_SESSION['form_html']; That seems to me like is proff against both page reload and back button problems. Or did I goof by trying to reinvent the wheel?

View 2 Replies View Related

Make Firefox Reload Page When Back Button Is Pressed?

Jan 7, 2011

I have tried every combination and permutation of meta tags that are supposed to stop a page from being cached, but Firefox STILL caches the page! I just need the URL to reload when a user presses the back button. Works fine in IE8.

I have tried all of these...

<meta http-equiv="Cache-Control" content="no-store" />
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="-1"/>
<meta http-equiv="Expires" content="Sat, 1 Jan 2000 00:00:00 GMT" />

...and I have also tried the following JavaScript...

<input type="hidden" id="refreshed" value="no"/>
<script type="text/javascript">


... all to no avail. What am I missing here? Pages are generated with PHP if that matters.

UPDATE 1: I have tried every suggestion thus far but I still cannot get this to work. When I use Chris's PHP code I use it like this...

header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");


.. and as you can see it is at the EXTREME top of my webpage, before the DOCTYPE header. I have also experimented with session_start() but even after reading the manual I am not sure I am using it right. I was putting it right at the very top of my page as well. I am open to ANY SUGGESTIONS that make this work without breaking other page functionality. Turns out I had multiple issues working against me, but through due diligence I was able to eliminate those issues and emerge victorious.

After Chris updated his code to...

header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");


I found that his code did indeed work when I used it EXACTLY how he had it with NOTHING else, but when I put it into my pages it didn't work. All of my pages are either .php or .html and all are attached to a DWT (Dynamic Web Template), so I was updating all of them at once with Chris's code. What I didn't realize was that the DWT starts RIGHT AFTER the DOCTYPE header, so the code was never inserted into my pages. I could find no way to make the DWT include the DOCTYPE header so I went into all my pages and manually inserted the code above the DOCTYPE header.

Next I found that even though my server is set to parse .htm and .html as .php the .html pages were generating an error at the very where I had inserted Chris's code saying something to the effect of "cannot modify headers, headers have already been sent". I didn't really care what my extensions were so I just changed all my .html extensions to .php extensions. A final minor annoyance was that even though the page was now not being cached (just like I wanted) Firefox was placing the user at their last location on the previous page when they used the back button (i.e. if a user was at the bottom of page a when they navigated to page b, then the user used the back button on page b they would be returned to the bottom of page a, not the top of page a as desired). Trimming down my original JavaScript fixed this...

<script type="text/javascript">


View 6 Replies View Related

Press A Button On The Back End?

Feb 9, 2010

i have about 10 people viewing a certain page at all times during the day. I need to have an alert pop up on their windows, so if its minimized it'll blink.

I just need to press a button on the back end, and have (front end) their windows blink, or alert, or play a faint little 'ding.wav'. what is the best route? im posting here because someone said itd be easier to do in php? i figured itd be ajax or js or something?

what are some of the issues with this?page refreshing? will they even get the alert? or just on my screen? sorry if this is in the wrong location, liek i said, someone mentioned php for that. here i am.

View 14 Replies View Related

Preventing Back Button Press

Aug 22, 2007

I am making a form which has name and code (captcha image) as fields to be entered. I have given a timeout of x so if the form is submitted after x secs then it will print timeout and also used a token verification. If the user submits a data then processing is fine. But when he presses the back button of browser and submit again then the captcha image remains same. [but changes when the form is refreshed] So the user in this case submits the form presses back and then submits the form and floods my database with same data again and again.

View 1 Replies View Related

Back Button Takes The User Back To Protected Page After Logout -zend Framework?

Mar 9, 2011

I have created a pages login , logout to access a control panelscenario goes like this: user logs in and accesss the cpanel page and them logs outProblem : when login is done if user click on browser back button user goes back to login page even though authentication is done and sessions are set, at the same time if user logout , and click back button it will return back to control panel page (if user refresh the page then everything seems to be fine and usr will be redirected to login and back button won't redirect her to cpanel ) .The problem is browser cache , I tried with both php header and html meta to prevent the page from caching but I could not succeed . Any solution to this?My logout action code is as follow

public function logoutAction()


View 4 Replies View Related

Reload / Refresh On Back Button?

Jun 20, 2011

Code: [Select]<?php
^^Does not work, except IE7

When I click on a link off of the above page, then hit the back button on the browser, I need the page to reload so that the new 'date' will be echoed.

View 5 Replies View Related

Display Results So Back Button Does Not Ask To Reload POST Variables?

Dec 9, 2010

I have a form that uses XML to get results. From those results users can click to a detail page. My problem is when a user clicks back to the results page, they are asked if they want to submit the form again. How do I create this so back button just displays the results, like on, ebay, autotrader, etc.

View 3 Replies View Related

User Needs To Press The Submit Button Before The Iframe Is Populated.

Aug 14, 2006

I have a search box that is included on all pages. When entering your search it takes you to the search results page which list results from my MySQL database. The thing is I take the string that has been input ($keywords) and auto enter it into my google search box of which the result of this search is displayed in an iFrame under the search results from MySQL.

The only problem is that the user needs to press the submit button before the iframe is populated. There for is there a way that this can be done automatically as I would like hide the google box and have the user submit only on the original search.

View 2 Replies View Related

How Do I Force A FRESH RELOAD Of A Page

Jul 19, 2003

I've built a few php scripts, but since its reloading the same page I can't get it to refresh the page. I've implemented some expire meta tag...but is there anyway I can try and force it to refresh?

View 3 Replies View Related

Save Data In Input Fields When They Press "BACK BUTTON"

Nov 28, 2009

this is html form: And let's say they get a error "Please enter ur title must be more then 3 character" then they click the BACK BUTTON AND ALL THERE DATA IS GONE!!

Code: [Select]<form action="u.php" method="post">
<INPUT TYPE=hidden NAME=name VALUE="<?phpecho$_SESSION['user_name'];?>">
<fieldset class="in" style="width:804px">
<legend>Submit Prayer</legend>
<div class="p9 ce">


View 1 Replies View Related

When Press The Submit Button It Doesn't Navigate To A Different Page?

Mar 23, 2011

I'm using the following form, but when I press the submit button it doesn't navigate to a different page

<form id="form1" name="form1" method="post" action="">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<td colspan="4" align="right">


View 2 Replies View Related

Auto-press A Submit Button Through Page Arguments?

Jun 14, 2011

I have a private system that requires a user to login. It links to a separate webmail login page that requires users to enter the same credentials twice. I can pre-fill these fields in with html parameters, but I can't seem to find a way to auto-submit.

View 3 Replies View Related

POST To Certain Page Based On Button Press - HTML And CSS?

Jul 7, 2009

I have a page with a form containing a textbox and a few buttons. When the user clicks a button, i would like them to be redirected to a new page and have the textbox content POST to that page. Is this possible?

View 5 Replies View Related

User Can Log Back In IE After Logging Out By Hitting Back Button?

Jul 27, 2010

I am using a PHP login script that challenges user for username & password.Once authenticated program stores a session value. On logout, session value is
set to blanks.Here is the problem:In IE 8 (not Firefox), user can hit back button a few times until thescreen which shows "Web Page has expired" message. This is likely the login screen.If he presses F5, it looks like username and password are still hanging aroundin POST variables and he gets logged back in.

View 3 Replies View Related

Does 'Back' Reload The Page?

May 14, 2007

I notice that when I click the 'Back' button my previous script runs, i.e, all the php code runs (I previously thought that maybe the previous form displays without the code re-running).
However, I do not get the expected value displayed on my form.

After populating one element in formA with &#3917;' (just any number) and submitting to formB (using POST ---> Redirect --> GET to avoid the 'expired from cache' message) I then click the 'Back' button and the 17 does not appear. In the code below, after clickng 'Back', I see as output from the echo statement that rb_value[0] is, infact, &#3917;' but within the form, the text element named rb_value[0] displays as empty.

Does anyone have suggestions why this might be?

It might have to do with that I do not understand what the 'back' button does. Or maybe with my PRG (post - redirect - get) model.

Here is part of the code:
echo "rb_value[0]=".$rb_value[0]; //After clicking 'Back' I see that rb_value[0] is 17

if (isset($rb_value[0])) {
$rb_val = $rb_value[0];
} else {
$rb_val = 1;

$line.= "<td width="20%" valign="center" align="left"> ";

// This element displays as empty instead of the expected 17
$line.= "<input type=text name="rb_value[0]" value="$rb_val" size="25" maxlength=25 </center> "
$line.= "</td> ";

View 5 Replies View Related

Back Button With $Sessions And GET - Browsers Dont Rebuild A Dynamic Page When You Click Back ?

Jul 15, 2004

If your familiar with database search results, then you probably know how useful the GET method is. My results page is a list of site members from the database. We want to have a feature that allows users to add these members to a html select box to "save a list of favorites". Every time a user clicks the Add button, the page redirects to itself and we are using session variables to save the list.

Here's the problem with the Browser Back button

1.) Lets say your on page one and you add two members to the list. The GET url will have &list=1,2 appended to the end where 1 and 2 are the two members. The session looks at the variable called "list" and makes an array from the list

2) The user goes to page two of the search results. They add another member. Because the page redirects to itself right after adding to save the added member, the new GET url is &list=1,2,3 The session is resaved with this list

3) The user clicks "BACK". Browsers dont rebuild a dynamic page when you click back so the member that got added in the second page is not present.

View 1 Replies View Related

Disable The Back Button So That It Would Not Go Back To The Login Page?

Jul 19, 2010

I have a login page and when i input my username and department and i click the submit button i link to another webpage..the problem is when i clickthe back button i go back to the login page. I want that I couldnot go back to login page because i am already login..i don't know what could be the code for that..this is my code in login:

require_once 'conn.php';

View 11 Replies View Related

Force Browser To Re-request Page After History.back()

Jun 11, 2010

I've got two scripts: 1.php and 2.php. Here they are:

header('Pragma: no-cache');
header('Cache-Control: max-age=1; no-cache');
header('Expires: Tue, 1 May 1985 01:10:00 GMT');
header('ETag: "'.md5(rand(1, 1000)).'"');

Visitor lands on 1.php and then goes to 2.php. I want browser to re-request 1.php after vistor's click on "back" link. Currently, it doesn't work. How it can be managed? upd. I can edit 1.php ONLY and cant edit 2.php.

View 1 Replies View Related

Using A Button To Set Session Data And Reload Page

Dec 14, 2009

I'm trying to design a page that will show information based on selections made by the user. For example;

I'm logged in so the page shows me all the leagues that I play in as a series of forms which just show one button each. These forms submit the variable for the league name - so far so good.

I can set the action for these forms as 'somefile.php' and assign the $_POST[league] to the $_SESSION and echo this value, so I know that the data is being passed correctly by the form.

What i want to do though is set the form action to something that will allow me to reload the same page, now with the $_SESSION['league'] variable set and as a result show the games within that league. So each time a player presses teh button for a new league the relevant games are shown.

I've tried to set the form handler to redirect back to the page using header() but it doesn't seem to pass the $_SESSION['league'] variable back so the function for checking if the league is set fails?

View 1 Replies View Related

Reload Outside Page OnClick Of Submit Button

Jun 6, 2007

I'm using frames to create a "bookmark-like" page. You can enter a URL and it gets added to my database. I have two frames (leftFrame - to display bookmarks entered and mainFrame to show web page). I want the leftFrame to automatically refresh when the user enters a bookmark. As of now you must physically refresh the page to see the results. Here's my code:

View 6 Replies View Related

Execute A Script When Someone Presses A Button Without The Page To Reload?

Aug 12, 2010

I was just wondering if it possible to execute a php-script when someone presses a button without the page to reload or is this done with javascript.So for instance a calculator. I would be more than pleased to hear and if possible even a short example.

View 4 Replies View Related

Can't Send Cache Limit Cheaker And Back Button Session Variable Still Displaying After Logout And If Prees Back Button?

Jan 25, 2010

1.As user enter username and password in sign-in-form.php then values are collected in sign-in-action-form.php page and the i am storing username into session variable like thisIn database i have a table named employee

<a href="logout_file.php">Sign Out</a>
if (username and passwords are matched)


View 2 Replies View Related

Prevent User Fom Logging Back In After Logging Out By Hitting Back Button?

Jul 28, 2010

I am using a PHP login script that challenges user for username & password.Once authenticated program stores a session value. On logout, session value is set to blanks.

Once logged out I want to avoid allowing user hitting the back button a few times and and betting allowed to see screen of data or accidentaly logging himself back in.

I am using sessions, a re-direct to send validated user to a new page. I am also using ob_start, ob_flush and ob_end_clean to prevent error or re-direct.

Questions:Is this really secure?

Is this a common approach?

Is there alterternative to buffering?

below is a small proof-of-concept.

header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
header("Pragma: public");[code]....

View 2 Replies View Related

User Selects Browser Back Button

Mar 10, 2006

I using a alert JavaScript message to display once an user submits a form, the message displays fine, but say the user goes to another screen and hits the browser back button, the same message displays again, is there a way to clear the message once displayed the first time.

View 1 Replies View Related

Stop A User From Hitting The Back Button?

Mar 30, 2007

Is there anyway possible to stop a user from hitting the back button?

View 4 Replies View Related

Preventing POST Again When User Clicks Back Button

Jul 17, 2005

I have a number of forms that do significant work based on variables
POSTed from the form. What is the common method of detecting and
preventing this work from being done when the form is POSTed as the
result of the user clicking the Back or Reload buttons in the browser?

View 5 Replies View Related

Getting User Selections On Clicking Browser Back Button?

Apr 26, 2011

My application has got several pages. On some pages I have given a back button on other pages it's not given (client's requirement). Now on a particular page, I have a list of choices (choices are image slides using jQuery plugin) to be selected by the user. Selecting a choice takes the user to next page. And now I want to get the same page with same selected choice as highlighted on clicking the browsers back button. On clicking the browsers back button, I guess the page is reloading loosing the cookie values i.e. when I select an image from my image set it takes me to another page. On clicking the browser back button, I wanted to get that page with same image selected from that set.Is there any work around so that I can get the selected values also on browser back.

View 2 Replies View Related

Check If User Hits Back Button In Browser

Dec 20, 2010

I'm trying to use the javascript onbeforeunload event to ask the user if they want to exit the page, but I don't want the event to fire (EDIT: "the event" being the dialog box that pops up asking the user to click ok to leave the site or click cancel to stay on the current page) if the user hits the back button since they will be most likely be staying on my site. So is there a way to tell if a user has hit the back button using javascript or PHP?

I've gotten a solution using a hidden iframe that only works in IE, but I need something that can work for Firefox, Chrome, and Safari if possible. EDIT: My IE solution works because when the user hits the back button the iframe is sent back but the parent page remains at the same spot. From this I can tell that the user has indeed hit the back button, so I then use history.back(). This little hack doesn't work in any other browser (to my knowledge), so I'm looking for a cross-browser solution.

tl;dr I'm using window.onbeforeunload to pop up a dialog asking users if they want to leave my site or not. I don't want this to pop up when the user hits the back button. How can I tell that the user has hit the back button in their browser?

View 3 Replies View Related

Stop A User From Hitting Back Button And It Not Reloading?

Nov 5, 2009

I have a php page that a user logins to and it pulls from a database a number. This number is an amount of money to spend. Once the user fills out the form on the page it then on submit does an UPDATE query and changes the amount to minus what they just spent. The problem I am having is that on the next page the person is hitting the Back button and the previous page shows with the original amount and allows them to submit again.How can I make that page not be able to be seen from the back button? Does this make sense? Is there a way in php that if page referrer = x.php display: no no?

View 2 Replies View Related

Redirect To Home When User Click On Back Button After Logout?

Mar 4, 2011

I was wondering how can I redirect users to my hompage after they logged out when they hit the back button, kind of like facebook does. I was playing around with some javascript but nothing seemed to work.

PD: This will be for a Wordpress theme.

View 3 Replies View Related

Page If Back Button

Sep 2, 2007

I have a php page which is a sign up page, once signup is finished the user is redirected to a new page. Sometimes (and it's rare) the user hit's the back button and then re-submits the form etc. I mean like I said it's rare but still bothers me, so on the last page I kill all the sessions. Which only works if the user hits the back button but the page is refreshed. So basically I want to know if it's possible that when the back button is hit to refresh a php page?

View 6 Replies View Related

Force Reload

Jul 9, 2007

Is there any way I can force my php scripts to reload everytime they are used ?

View 7 Replies View Related

Send Back Data To Same Form When User Hits Submit Button

Mar 19, 2011

So I have a form that is on page 'index.html'. The user submits the form, which then goes to a processing page, say 'processing.php'. I would like call this processing page from the index page, assign the return value to a variable, and go from there. The problem I am having is that the page should only be called when the user submits the form on index.html page. So how can I call this processing page before the page actually gets submitted and sent to that page? (I don't know if I am making sense, but I want the user to hit submit, then that action calls on processing page which returns the result back to the index page to display)

View 5 Replies View Related

Reload Page If User Has No Javascript Enabled?

Feb 18, 2011

is there way to reload a web-page, when javascript is disabled in the brwoser?I mean, if the user visits the page first time, and has no javascript enabled, the page reloads with a get parameter like page.php?js=false.

View 4 Replies View Related

Back Button Not Reloading Page?

Sep 5, 2010

test1.php has this code
header("Cache-Control: no-cache");
header("Pragma: no-cache");
$a=date("D M Y ; h:m:s");
echo $a;...........

then when i visit test1.php and move to test2.php then on pressing back button why is it not displaying the current time instead displaying the time i last visited it. its a simpler version of my previous problem

View 1 Replies View Related

Disable The Back Button In That Particular Page?

Sep 6, 2009

i have a some problem using the browser backbutton in perticular page. so i want to disable the back button in that perticular page/ even click the back button it takes to same page.

View 2 Replies View Related

Force Image Reload In Php

Apr 13, 2007

So for the project I'm working on, I have an image that gets converted from an eps file fairly regularly. When you go to the page that displays that image (the gif, not the eps) it isn't aware that the image file has been updated in the background and it always loads the cached file unless I push refresh/reload. Is there a way in PHP/Apache to get that file to always load from the server rather than from cache?

View 7 Replies View Related

Form Reload : If User Click The Reload Or Refresh In IE, There Is A Warning Window Popup?

Oct 29, 2009

I am writing a very simple code which involve HTML, PHP and Mysql, here is what I have done and the Help I need: the 1st file: index.php

PHP Code:


the DB/table related: I have a DB named mydb in MySQL, which have on table, comments:

`user` varchar(30) NOT NULL,[code]...

load index.php after you creat the table using above sql..and jump between index.php?id=aa and index.php?id=bb, and u can submit the form and see the comments imm showing after ur looks great, BUT My problem: if user click the reload or refresh in IE, there is a warning window popup, and remind user not re-submit, but if some user really resubmit, my table will have duplicate change on my entire scripts stucture, means I must use above ?id=$_GET(id) tech to jumping between the aa file and bb file, and I must include both form and insert process in same file, the user expriense should not been impact........

what I need is while user click the reload, no pop window, no duplicate record been insert

View 14 Replies View Related

Reset Dropdown And TextBox To Default Values If User Clicks Back Button?

May 14, 2010

I currently have 3 dropdowns. The 1st one will open up the 2nd 3rd ones. The 2nd one has just 1 value and the 3rd one has about 60 values the user can choose from. Then they fill in a text box and click submit. After that, it takes them to the results.php page which will give the results of their selections.

If the user clicks on the back button, it shows all of the default values, but box 2 and 3 (dependants) are missing. If they click submit again, its a whole mess. What I want to do is if the user clicks on the back button, all of the fields need to go back to the default selections.

View 2 Replies View Related

Check If User Has Cookies Enabled Without A Page Reload?

Jan 11, 2011

For example, code such as the following doesn't seem to work, even if the cookie is actually set, until I refresh the page.

setcookie("cookies","1", time()+ 86400,"/" );
if (!isset($_COOKIE["cookies"])) {
$cookies = "foobar";

Im trying to write an accurate "unique user" counter on my site, which works based on checking to see if a user has a cookie set on the computer, if they don't, it does +1, and sets the cookie. The problem here is that, the users without cookies will just +1 on every page load, so naturally I only want to run this code for those who have cookies enabled.

The cookie checker above however will always return $cookies = "foobar" on the first page load, regardless of users having cookies on, or off. So if a user just views 1 page of the site, their visit won't be registered by the counter.

View 2 Replies View Related