473,974 Members | 29,107 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Page Reload and Cache

18 New Member
Hi, I have a simple html scenario:
<html>
<head>
</head>
<body>
<img src="myImage.pn g">
</body>
</html>

I want a script that forces the re-loading of the page each time myImage.png is changed via ftp.
So i I tought to do a check with the filemtime() function once per second and then eventually force the re-load.
I've got two problems: 1. How to force the reload?
2. When I open the browser and go to www.mysite.com I see the cached version of the image until i don't press f5.
How can i solve that? Can I force a kind of no-cache?

Thanks.
Feb 4 '08 #1
1 1813
nathj
938 Recognized Expert Contributor
Hi,

If you wnat to force the browser to get the page from the server and not from cache then you need to do something with headers. Take a look at this PHP Headers manual.

Also, if you put the following code at the very top of the docuemtn - before anything else, it must be at the very top, no spaces before it or anything that might deemed as output.
[php]
<?php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires : Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>
[/php]
This prevents the page from coming from cache.

I've not tried this myself but it should work.

Cheers
nathj
Mar 20 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
8546
by: Dominic | last post by:
I have a home page on an intranet called default.asp I just type in the server name to take me to the default page http://server. The home page has an anchor name tag: <A name="fred">Freds Info</A> It is located by this anchor href tag: <A href="#fred">Up to Freds Info</A> The problem is that when I first use the link to take me up to Freds Info, the default.asp page is reloaded then I am taken to the Freds Info, which is a pain I...
1
2918
by: Dave Blair | last post by:
Hi, Hi, In firefox I can't get a page (which queries an SQL database and shows all the available records) to re-fresh with new updated data after a 'javascript:history.go(-4)' is used to return to the page after a new record is added. I have the following code in the page which displays the records:
3
17739
by: Nige | last post by:
I'm not sure if this is the right group, but I thought the solution may be JS related, hence my post. I've got a web site that is frequently updated; yesterday several subscribers contacted me to say they couldn't see the update. I suspect this is a cache problem, so is there a way to force a page to be reloaded when it is changed. I realize it is too late for the current pages, but I'd like to include something later.
37
12789
by: ajay | last post by:
How to make a web page getting refreshed after a given time interval automatically. HTML Code plz. Tx Ajay
2
4351
by: James | last post by:
I've been to websites where if I navigate off a form, trying to get back to it by hitting the back button gives me a page which says "Warning, page has expired". It doesn't display the page. I've been searching around trying to get this to happen for one of my aspx pages and I can't get it to expire. I've put the following HTML tags in the page: <meta http-equiv="expires" content="Sun, Dec 31 1970 12:00:00 GMT"> <meta...
3
5037
by: 4psite | last post by:
I am creating (using php) an html page with many links. Clicking on a link open the link as _self. Clicking on the browser back button brings the prv html page (with the links,) but instead of getting it from the cache it will recreate it. My questiosn, how to avoid the re-creation of the php/html page and just to reload it from the cache. Coby
0
1168
by: tshad | last post by:
I am having a problem with a page that loads a user control that absolutely must reload if there are errors on the page. But if you have IE set to never check for newer versions of the page, it won't reload a new page. I have a random number being redisplayed on the screen that doesn't get updated if the user has this setting set. I tried the following on the page: <meta http-equiv="Pragma" content="no-cache">
1
3538
by: Rob | last post by:
I know this is an old one, considering how many posts I found on it but I just wondered if any best practises had popped up recently, especially as Ajax has increased JavaScript and DHTML's importance. I'm writing a database application. I like pop-up boxes so I've implemented one on my webpage using a floating DIV. The logic goes like this: 1. When the page is rendered (on the server), it adds "var DisplayPopup = false;" in the page...
4
1422
by: Stubbo of Oz | last post by:
I want to put a link on my web pages to allow the user to click and refresh the page. I have seen twqo ways to do this:- <a href="javascript:location.reload(true)"> <a href="javascript:history.go(0)"> Are they both legitimate?
5
6813
by: =?Utf-8?B?Y2hlY2tyYWlzZXJAY29tbXVuaXR5Lm5vc3BhbQ== | last post by:
I have a site which I secure with forms authentication. When the user's sign on and hit one of the secure pages, I have this line in my code to ensure that the browser does not cache the page; and someone cannot navigate back to an cached image of the page in theory after the user has signed off. Response.Cache.SetCacheability(HttpCacheability.NoCache); This works all right, except when the user decides to use the browser's back...
0
10347
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11811
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11399
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8453
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7600
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6543
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5148
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4726
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3755
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.