Is There A PHP Function To Force A Browser Refresh

May 24, 2007

I have an html page that gets updated about once a week. I would like to FORCE the browser (IE, Firefox, Netscape, or Opera) to REFRESH when the user opens the page to ensure they receive the latest update. Been searching around for some php code to add to the page to accomplish this without success. Can anyone give me a steer to how to accomplish this.


Making A Function-Activated Link Appear Without Having To Refresh Browser?

Jun 10, 2010

I'm trying to use the code below to make the <a href=''>Vote</a> link appear if a user logs in and a user shows up in the function getEditorsList(). The vote link only appears if the browser is refreshed.

how I could make the vote link appear without having to refresh the browser?

PHP Code:
require_once "header.php"; 


View 2 Replies View Related

Refresh Browser To Refresh Site - Fatal Error: Maximum Execution Time Of 60 Seconds Exceeded In

Jul 25, 2011

this is the first time that i've come across such error. When i tried to refresh my browser to refresh my site, the computer starts eating up my ram, and this error came out about 2 minutes later:

Warning: mysql_query() [function.mysql-query]: Unable to save result set in D:Dropboxhtdocsercygestionabonnes_amanfunction_search.php on line 64

Fatal error: Maximum execution time of 60 seconds exceeded in D:Dropboxhtdocsercygestionabonnes_amanfunction_search.php on line 64

The problem can be solved if i comment out both these part:

Code: [Select]LINE 64: $result = mysql_query($sql_query) or die(mysql_error());

but, these errors came out:.....

View 5 Replies View Related

Force Refresh

Aug 6, 2007

I basically need to have a certain page reprocess the php when it's accessed by either the forward or back buttons. The current (default) behaviour has it just reload the page from the cache, as normal. This will not work for our purposes it must reload completely. We need the php & database access on every load of this page, and that's currently not happening.

View 2 Replies View Related

How Can I Force A Refresh When They Make A Change.

May 27, 2005

I'm working with a form, and when the user makes a selection the selection only affects the parts of the form past where they made the selection. I need to do a refresh so that the entire page will be affected, how can I force a refresh when they make a change.

View 10 Replies View Related

Force Refresh On Ajax Request?

Jul 21, 2009

I have a script which at one point returns an image thumbnail using jquery built in java request.

Every time the php function get called, this thumbnail gets updated, but keeps the exact same filename. Problem is that the browser caches the thumbnail and it looks like it never gets updated.

View 3 Replies View Related

Force Browsers To Not Request Resource On Refresh?

Dec 21, 2010

I'm trying to force the browser to cache different resources like CSS, images, js and so on forever. It is important for the browser to never try to refresh the images/css since on a page there might be thousands of small images, and when the browser tries to refresh it bombards the server, and needlessly keeps the page in refresh mode. The images/css's never change nless the request path changes. Right now I have the path to the images/css set to a script with a url like: [URL] and the script is sending these headers before sending the resource:

header("Cache-Control: public");
header("Expires: Tue, 19 Jan 2037 00:00:00 GMT");
header("Last-Modified: Sat, 01 Jan 2000 00:00:00 GMT");

However Chrome and Firefox both re-request the image/css if the Refresh button is hit. Chrome also seems to send the request if you hit Enter on the address bar, unlike Firefox. My question is why do they do this since the Expires header should make it not do the request again until 2037, even if the users presses Refresh. Am I doing something wrong, or missing something?

View 2 Replies View Related

WWW-Authenticate: How To Force Password Login At Every Page Refresh ?

Jul 17, 2005

The following sample should authorize the user to log on the site.
This works once but after refreshing the browser, it does not prompt
again for login until all browser (IE 6) windows are closed and the
same page is opened.
I turned off all caching but still it does cache (as a refresh doen
not promt again).

How can I force the page to prompt for a password at every refresh



$showall = false;
error_reporting (E_ERROR);

if (($PHP_AUTH_USER != "myname") || ($PHP_AUTH_PW != "mypass"))
header('WWW-Authenticate: Basic realm="Secure Login"');
header('HTTP/1.0 401 Unauthorized');
$showall = false;
error_reporting (E_ALL ^ E_NOTICE);
$showall = true;

if (!showall) {
echo "access denied";
} else {




<? } ?>


View 2 Replies View Related

How To Stop Jpgraph (gd Library) From Caching Or To Force A Refresh

Mar 14, 2007

I'm using a bunch of graphs all over my site to display various statistics. Some pages have lots, some have one. The big issue is that if I display the graphs for a particular page multiple times in a row (changing the parameters each time) the graphs don't refresh. Instead the same graphs are shown each time!

Is this because of caching or some php setting or some apache setting (using apache2 btw)? Is there any way to get around this or to force the graphs to refresh?

View 4 Replies View Related

Force A DOM Refresh When Running Multiple Ajax Tasks In A Loop?

Aug 15, 2010

Emails to customers.It has a send all button at the bottom of the page to provide the convenience of being able to send all the emails at once.Problem is it works badly or not at all.It either isn't redrawing the page or isn't managing to process all the Ajax calls.

function ajaxemail(element,name,email,bonus)
if (window.XMLHttpRequest)
code for IE7+, Firefox, Chrome, Opera, Safari


The failure isn't in the page being called by function Ajax email()because that works fine when called once or one at a time.It's when called by the loop that it doesn't work.It seems to do the last one or two items in the loop, or it might do some in between if I do something that forces the browser to redraw(such as size it).If I add an alert as a way of testing that execution of the loop is at least working it successfully runs the Ajax call on every iteration.It doesn't matter if the page becomes less responsive(but would rather it didn't become totally unresponsive)I am testing in the latest Firefox(will test in other browsers once I have it working in FF).

View 1 Replies View Related

Can PHP Force A PDF *NOT* To Load Into A Browser?

Mar 6, 2006

I'm wondering if there is any way to use PHP to force a PDF not to load into a browser window. Currently we have a link to a PDF on a clients website and they want it to be downloaded via the 'Save Target As' menu. They do not want it loading into a browser.

View 3 Replies View Related

Force Browser To Download?

Jun 13, 2011

I'm using a .htaccess file to make links to JPEGs download instead of opening in the browser window. This is what I'm using:

AddType application/octet-stream .jpg

It's working fine in Safari and Firefox on Mac OSX but not on IE 8 on Windows. Is there any way around this apart from writing a header in PHP which I would rather not do?

View 4 Replies View Related

Force Browser Download Of Content

Oct 21, 2002

Ok, this isn't a "How do i force the browser to download my file..." question.

This is a bit different because what i want to give the user isn't a file.

I want to provide a copy of a database table as a CSV file.

View 1 Replies View Related

Force Download From A Browser Link Using FTP

Jul 19, 2006

Ok, so i know how to force downloading in a browser using:

header("Content-Disposition: attachment; filename=x.avi");

But... what if the file isn't on the webserver, but on a remote FTP server.

So, I have a link like this:

<A HREF="">click here</A>

And of course if you click on it Windows Media Player launches and it tries to play. How can I force the download?

View 5 Replies View Related

Force A Browser To Cache Image?

Jul 4, 2009

Ok here is what I am wanting to do: Host an image on Photobucket, Use PHP to generate the image with a url as if it is being hosted on my site and cache the php generated image for faster loading later.

I am currently using a photobucket account to host my images so the original file I want to cache is actually at the following [URL].../albums/k126/WrestleMation/Brain_Rush_S01E01_DotNXT_DSR_XviD-E.gif[/code]

I am wanting to display the image with a URL from my site so that it doesn't show the fact that it is on a photobucket account.[URL]../fa_Brain_Rush_S01E01_DotNXT_DSR_XviD-E.gif[/code] As you can tell the image from the second link is being generated to pretty much pull in information from the first one and the displaying of the first one under the new URL works just fine.

To do what I've done, I used .htaccess rewriting to make the php image generation to use a standard image format url.

The php I used to generate the php image is...
[code=text]//Get dynamic filename from rewritten url. --- which would be : Brain_Rush_S01E01_DotNXT_DSR_XviD-E
$gif_file = "".$_GET['file'].".gif";
//Load the image
header("Content-Type: image/gif");
echo readfile($gif_file);

Ok so the image is generated just fine with my code but the problem is that it has to reload and redownload the image every time the browser is refreshed. Is there anyway I could force all browsers to cache the php generated image so when the generated url is called the next time it pulls from cache instead of pulling from the photobucket account?

View 3 Replies View Related

Force The Browser To Prompt For Download Of The File

Mar 16, 2006

I've got a script that generates a csv file on the web root, and currently if I try to redirect to it, it just opens the file in the browser. I'm wondering, is there a way to force the browser to prompt for download of the file insted?

View 7 Replies View Related

How To Force Browser To Reload Image From Server?

Jul 17, 2005

This is probably more of an HTML question than PHP. Perhaps someone
here can answer or point me to a proper newsgroup.

How can I force the browser to reload an image from the server?

I have a page where the user can set some parameters and click a
<submit> button. A PHP script then generates a .png graphic and saves
it to disc. An html statement (<p><img src="gMyGraphic.png"></p>) then
sends the graphic out to the browser. Code:

View 4 Replies View Related

Force A Browser To Show The Latest Changes To A CSS File?

Oct 17, 2009

I made some changes on a CSS file on a PHP site.

The changes do not show up in any browser I test it on until I hold down the CTRL key and click the browser's REFRESH button.

This means that most users are not going to seem the changes I made.

How can I force browsers to show the changes to CSS files immediately (without renaming the CSS file)?

View 3 Replies View Related

Refresh, Stop The Previous Function Being Called Again On Page Refresh?

Apr 17, 2011

I have a function that imports a files contents into mySQL and returns the results. If i refresh the page and click "yes" it will do it again doubling the output with the same content. How can I stop this happening? In this particular case there is no URI in the address bar but on other functions there is.

View 4 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

Force The User To Download A File From A Href Link Rather Than To Open It In A Browser Window?

Oct 1, 2010

Basically I wrote a script that generates a xml file based on user input. After the file is generated a download link appears like so:

<a href="path/to/file.xml">Download File</a>

But when clicked it opens the xml in the browser, I want it to start downloading when the link it clicked instead.

View 5 Replies View Related

Browser / Refresh

Jul 17, 2005

is there any way to force a refresh of a page that a user visits?
sorry i am still learning.

View 4 Replies View Related

A Browser Refresh

Nov 24, 2005

I want to basically change my image and data that is being pulled out of a database everytime the browser is refreshed. Heres the scenario i have 2 tables, rentals and sales that contain some of the same fields such as property name description and cost (theres an image too ).

I need a way to change what is displayed every browser refresh, so one time the data might come from one table the next the other table. I was thinking along the lines of setting up a holding table that stores the info from the two table , but i dont know how to tell it to change the data.

View 7 Replies View Related

Preventing A Browser Refresh

Apr 27, 2006

I've searched for solutions on how prevent a browser refresh from posting a repeat process, and a suggestion of redirecting the page to a "dummy" page which then flips back to the main page seems like something I can handle. My problem is, I'm not quite clear on the journey. Here's what I understand:

Page loads, waits for user input. User fills out form and hits "submit". Page inits, with $_POST variable populated with form data (I have a db_start() up top). HP code is processed, at which point I take care of form data.

here is where I'm not sure how the redirect should happen. I'm thinking efore page is released to browser, I redirect the page to the "dummy" page with something like this:

$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/');
$extra = 'dummy.php'
header("Location: http://$host$uri/$extra");

Finally, the dummy page has a single header command to reload, sans $_POST variable, the main page.

View 6 Replies View Related

Refresh Browser Remotely From Server. How????

Jul 17, 2005

Just wandering how can you close a browser remotely. In some web
applications the browser closes or refreshes periodically.

How is that done and how can it be done through PHP?

View 4 Replies View Related

Browser Refresh On New Database Entry

Dec 12, 2006

I have a free-ads type website and when a new ad is uploaded it needs to be sent for manual authorisation. What i would like to do is have a pop-up window that will refresh itself or something similar when a new ad has been uploaded so it flashes orange in the start bar much like msn messenger would do.

I was wondering if this can be done in php? (I'm very doubtful) but im sure it can be done somehow using JavaScript or AJAX? (which i know nothing about). If possible can anyone help with this. I have my website coded in PHP so if possible, i would prefer help in PHP but i'll use a different language if it makes better sense.

View 3 Replies View Related

Clear The Browser Cache And Refresh ?

Dec 15, 2010

I have a script which allows a visitor to the web site to upload an image. Since this replaces an earlier image, it gets given the same name (desirably). The upload, and the renaming happen OK. But when all is committed to the database and the visitor is shown the result, the old image is still visible. Clearing the browser cache and refreshing the screen (manually) shows the new image.

Is there a way I can get PHP (or JS, I suppose) to do this automatically as part of the script ?

View 4 Replies View Related

Refresh A Page On Browser Back?

Oct 20, 2010

I have a page with 2 dynamic headers. The first header shows a link to a sign-in page if the user isn't signed in. The second header shows the users name and a link to a sign out page if they are signed in.

This all works well but I have spotted a usability problem. If the user clicks the link to the sign-in page then signs in and selects BACK the old sign-in header still shows. It looks as if they still need to sign-in, until they move off to another page then the correct header is shown.

This is probably a problem with page caching. I have tried numerous things like "header (no-cache)" and unsetting the variable I test to see if the user is logged in all to no avail. I could test for a session variable but as with the header option - i am developing a template to be used on multiple websites and I don't want to require a session_start at the top of each page. I would prefer to keep my solution self-contained in the header.

View 2 Replies View Related

Refresh The Page In Browser To Link Again?

Jul 17, 2010

$connection = mysql_connect($db_host, $db_user, $db_password, $db_name)


The result in the browser when go to counter.php page has been viewed 1 times, But refresh the page or close the browser and go to the link again.The num_views does not get updated in the database, it still remains at 0.

View 2 Replies View Related

Cookie Question - Browser Refresh Button

Jul 16, 2005

I wrote a small .php script that creates a cookie on my local PC - I
also wrote one that deletes it.

My question is this: when the cookie has been created and I run the
delete .php script, when it first loads it does not delete the cookie
- I always have to click on the browser refresh button - why doesn't
the script execute on the first execution?

View 3 Replies View Related

Handle User Hitting The Browser Refresh

Jul 17, 2005

What are best practices to check to see if a .php script is called for the first time versus a user hitting a refresh button on their browser? I am playing around with a PHP front-end to a database. If the user enters values in a form (form.html), hits submit, the PHP script (insert.php) puts the submitted fields into the database as intended. insert.php displays a success message if successful or an error message otherwise.

If the user hits the brower refresh button while at insert.php, the data is re-entered,
and I end up with a duplicate entry in the database. This is the default behavior of Opera. IE prompts if I want to resend the data vs. not doing anything. If the data is resent, then the duplicate entry happens. I need to guard against this either way.

View 6 Replies View Related

Live Updates In Browser (without Manual Refresh / F5)

Aug 12, 2009

I have an idea for something but not sure which method would work best to provide the desired result. Let's say I have a database up and running, storing data for 2 users (php and mysql). What I want to achieve is: having 2 clients on the page with 2 different machines(different browser), have one user (do something), have the data stored in the database, then have user 2 see what has happened in as close to real time as possible.

Can this be done using JavaScript/Ajax to poll the database and update all browsers with a fast response time (100 ms updates?) is that too much strain for a hosted webserver?

View 5 Replies View Related

Avoid Duplicated Mails On Browser Refresh?

Aug 6, 2010

I'm using the following code to send me an automated mail in case the user find a broken link. But there are 2 problems: 1) after submitting I'd rather not disrupt their game by refreshing the page. So, is there any way to send mail without the post refreshing? 2) if the user hits F5, the page reloads and the code runs again, sending two or more times the same email. How can I avoid duplicated emails caused by manual browser refresh?

(the most important solution currently is how to to avoid duplicated entries, in case an ajax solution is too hard to post here.)

<form name="fbrlink" action="<?= $_SERVER['PHP_SELF']."?page=ok" ?>" method="post">
echo('<input name="sbrlink" id="B1" type="button" value="broken Link?" style="border:none; background-color:#FFFFFF; font-family:Trebuchet MS; font-size:15px; font-weight:bold; color:#1A4877; cursor:pointer; display:block; text-decoration:underline;" onclick="this.form.submit();"/>');


View 12 Replies View Related

Browser Refresh Causing Session Variable To Come Up Empty

Feb 24, 2003

Can anyone tell why the following code:

include "html.php";
include "./";
$time = $_SESSION['Time'];
$user = $_SESSION['User'];
$now = time();
echo "TIME1: $time<BR>NOW: $now";
if($now > ($time + 1200))
$query2 = "UPDATE users SET online = 'n' WHERE username = '$user'";
$result2 = mysql_query($query2);
/* ?>
<script language=javascript>
window.parent.location.href = "index.php";
<? */
$now = time();
$_SESSION['Time'] = $now;
$time = $_SESSION['Time'];
echo "<BR>TIME2: $time";


Would initally return:

TIME1: 1046151365
NOW: 1046151365
TIME2: 1046151365

And after refreshing the browser a couple of times it returns:

NOW: 1046151511
Warning: Session object destruction failed in c:inetpubwwwrootdiningsess_mgmt.php on line 14
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:inetpubwwwrootdininginbox.php on line 47

Obviously the session variable isn't returning a value after refreshing the browser. but why would that be??!?!?!!? sorry i'm not too well versed in sessions and any help you can provide is definitely appreciated....

View 1 Replies View Related

Refresh (back?) Causing Browser To Resubmit Form

Feb 17, 2006

Ive got a form on my site where users are registering and paying for a service, which is submitted to a 3rd party site which takes care of the financial aspect and then forwarded to a confirmation screen on my page.

It seems as if some users are hitting the back button and resubmitting the data, as they are being registered multiple times.

What would be a good way to get around this, so they could not go back to the page where the form was submitted and therefore re register?

View 4 Replies View Related

Cookies - Outputting Getcookie Variable Without Browser Refresh?

Jul 1, 2011

I am using the following code to output a block of content without a cookie, and another number if the cookie has been set. Problem is that the getcookie variable doesn't work until the page has been refreshed, or the user navigates to the next page.I am happy to use the header redirect but not sure where to put it within this code (unless someone has a better solution to the code itself):

if (is_page(817)) {
setcookie("phonecookie", 1, time()+3600, COOKIEPATH, COOKIE_DOMAIN);


View 2 Replies View Related

Refresh The Page When New Data Stored In To The Table Across The Browser Sessions

Feb 3, 2010

Environment : PHP/MySQL/Jquery

I would like to refresh the page (ex: index.php) when new data stores in to the table (ex : new_entry_table) checking for every one minute. The same page will be opened in many machines(pc-browsers) at a time all should get refresh when new data arises.

using jquery and database check i tried the following:

$.post("new_data_check.php", function(data) {
if(data > 0){
return false;

new_data_check.php: : checks for new data in the test_db where newdata_field=0 ; : If any new data arises echo "1"; And update the newdata_field=1; to stop constantly refreshing the page. : else echo "0"; : Just for a trigger

So the above jquery code checks new_data_check.php every 1 min for the trigger , if any trigger arises it will refresh the container.But its getting refresh only one opened session other opened sessions(in other browser or other pc) not getting refreshed.

View 1 Replies View Related

Use Jquery To Ajax Only The The_message Field To Avoid Browser Refresh?

May 23, 2011

I want to avoid the browser refresh and get to display only the message without the browser refresh.

$idc = $_GET['id'];
$name1 = $_GET['name'];
$id2 = $_GET['ids'];
if ($_POST['message_field'] != ""){
$message_field = $_POST['message_field'];

View 1 Replies View Related

Jquery - Getting The Responses Form Displaying And Ajaxing Without Browser Refresh?

May 25, 2011

I want to id each comment so that where any member comment on a comment, the INSERT and the SELECT knows where to display the comments, who commented in a comment and in what comment. it is like creating an id for each comment so the SELECT display each message in its place. bu i don't know if it is an html, php or javascript issue to handle. the jsfiddle is here.


I do pick the id in the url string

$id = $_GET['id']; // this id of the user being commented in the user table I guess I will need that id to identify which user is being commented "profile" that's the id of his profile

if (isset($_SESSION['id'])) {
$userid = $_SESSION['id'];
$username = $_SESSION['name']; }[code].....

// here instead of $parent_id I use field created for responses to tag a comment as a response should be initialize somewhere in the top with a value of 0 or 1 depending weather it is a response or a comment. I am not sure weather I should leave the parent_id variable or come with this new field $sub_commented_id. What do you think?
// men_id is the field of the $userid, commented_men_id is the field for the commented on, $idc variable etc...

if (isset($_SESSION['id'])) {

if ($_SESSION['id'] == $userid ) {
$the_message_form = '[code]....

That's what I have so far. the first form the parent form is submitting and posting with the jquery of id #message, then the #bring id for the id of the second form or the response form is not working properly, it is inserting but posting the comment in the p tags with id only., that's where the parent comment post not the response comment form.

the comment text is sliding toggling but the second time I click on, meaning sometimes it won't toggle the first time I click on it. But the main issue now is getting the responses form displaying below and Ajaxing without browser refresh.

View 1 Replies View Related

Is There A Form I Can Refresh The Previous Page When The Browser Back Button Is Hit?

Mar 13, 2007

I have a small online contest on my page, forms work great, but I realized people hit the back button and send me the form again and again without type anything. 

My question is:  Is there a form I can refresh the previous page when the browser back button is hit?  I think I can achieve this using cooking, correct me if I'm wrong.

View 1 Replies View Related

Force A Browser To Download A File When Someone Hits A Download Button - Doesn't Work In IE

Nov 7, 2010

I have this script and I try to force a browser to download a file when someone hits a download button. here is what I'm trying:

header('Content-Type: application-download');
header('Content-Disposition: attachment; filename=' .basename($dl_id));

It seems to work in Chrome, Firefox, but it doesn't work in IE

View 3 Replies View Related

Caching - Clear Browser Cache To Avoid Form Data Resend After Refresh

Nov 16, 2010

I'm developing a PHP-MySQL app that enables registered users to enter text comments. Problem is:

User sign-in into the web site - OKAY
User presented with a form to submit text comment - OKAY
User enters text comment and submits - OKAY

I have a routine that sanitize the comment & save it into MySQL (with userid, textcomment, datetime stamp) & present back the user that his/her comment is entered - OKAY

User decides to refresh browser - a duplicate comment is entered - BAD!

I was thinking 3 options: OPTION 1: Routine that checks: last time user posted comment, and if so, check if this is a duplicate. If duplicate then display error message. OPTION 2: Routine that does not allow a user to post too quickly. So basically do not allow postings of comments within 1 minute or so. So if browser is refreshed the comment will be ignored. OPTION 3: Manipulate the browser cache to clear out its contents so when refreshed no duplicate will be entered.

Now in the context of my application, my concerns with OPTION 1 and OPTION 2 is performance PHP-MySQL since I already have various queries within the same page that push/get data from databases. So OPTION 3 may target the issue differently. Questions is: If I go for OPTION 3 can this be considered a Best Practice?

View 5 Replies View Related

/function To Zip And Force Download The Files?

Feb 9, 2010

//function to zip and force download the files using PHP

function zipFilesAndDownload($file_names,$archive_file_name,$file_path)

View 1 Replies View Related

Html - Force Overlay If Function Returns False?

Sep 24, 2010

I need a way to invoke a non-closable, iframe overlay where the user will have to choose their membership before being able to access any of the pages. I am doing a DB check for something, an if it returns false, then i want to invoke the overlay somehow without disrupting the session_start() function.

View 2 Replies View Related

Avoid Duplicate When User Click The "refresh" Button Of Browser?

Dec 26, 2009

For example, I ask this question and click "Post your question" and stay in the current page. Now I may click the "refresh" button of my browser to see new answers. But I find that on my website, if I click the "refresh" button, a duplicated question will be published. How to avoid this problem? I am using PHP.

View 3 Replies View Related