473,657 Members | 2,476 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

automatic image reload?

JR
Is there a script available to automatically reload images on visiting
a page? I change images once a week and they have the same name so
I'm not changing the page code. Some people have the previous week's
image in their cache. I'd rather not put a message line on the page
asking the visitor to hit the refresh button nor use a code that
reloads the whole page unless reloding the page is an only option.

Thanks for your suggestions,

John
Jul 20 '05 #1
2 26273
Lee
JR said:

Is there a script available to automatically reload images on visiting
a page? I change images once a week and they have the same name so
I'm not changing the page code. Some people have the previous week's
image in their cache. I'd rather not put a message line on the page
asking the visitor to hit the refresh button nor use a code that
reloads the whole page unless reloding the page is an only option.


Append a unique "search" suffix to the src of each image.
You could do this as the page loads, but it's simpler to
do it after the load, as in this example:
<html>
<head>
<script type="text/javascript">
function refreshImages() {
var search="?"+(new Date()).getTime ();
for(var i=0;i<document. images.length;d ocument.images[i++].src+=search);
}
</script>
</head>
<body onload="refresh Images()">
<img src="http://www.azphx.com/dhtml/tmp/alpha6464.jpg">
<img src="http://www.azphx.com/dhtml/tmp/beta6464.jpg">
</body>
</html>

Jul 20 '05 #2
JR wrote:
Is there a script available to automatically reload images on visiting
a page? I change images once a week and they have the same name so
I'm not changing the page code.


Client-side JavaScript will not help you in general here: It can be
restricted, disabled or not even supported. You can define that
standards-compliant UAs should always re-download the document and its
linked resources from the original source (that should also exclude the
cache of proxy servers, you did not think about that):

<head>
...
<meta http-equiv="expires" content="0">
...
</head>

On the Web (using HTTP,) you can use the `Expires' HTTP header the same way.
See RFC 2616 for details.

Another way are cookies that store the date of last visit and if that was
more than a week ago, you force to reload with `location.reloa d(true)'. But
their storage may be seen as a violation of privacy.
PointedEars

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1507
by: Michael Huhn | last post by:
I have a web page default.aspx and a dynamic image image.aspx. Image gets parameters via querystring and outputs a gif. Using JavaScript I reload the image with changed parameters quite often. Sometimes it happens that the image does not appear (red cross instead) or that ie keeps loading for minutes. Opening that image in another browser gives me a "403.9: too many connections". Does iis create a new connection on every reload of that...
1
10853
by: Marco Maroni | last post by:
How to force image refresh on client browser ? Is ti possible to force the refresh of the same image (tha was changed server-side) to the client, without user press Contrl+F5 in IE ? - Marco
7
1921
by: fh | last post by:
hello! I 've a found way to reload my page automatically every n seconde using this code Response.AppendHeader("Refresh", "4"); it works fine but I wish to do the same with only a part of my aspx page that will reload to the server all the rest of the page has to stay static if I use a web User control but it reload all the page?
1
3411
by: Chuck Anderson | last post by:
I'm using a simple, pseudo progress bar. Very simply, I display a still image next to a form submit button until the user clicks on it, and then I change the image source to an animated version of the still image. Like so (I use php a lot) ... -- the submit button and still image -- <input type=submit name="update _stats" value="Update Mailbox Stats" class="button"> <img id="loading" src="still_image.gif">
1
4409
by: chris | last post by:
I am uploading a new image to my database. The upload works ok and the new image is stored ok on server. The problem is can I force a reload on cache to display the new image. If I reload the page it works fine but if i dont then the old image is displayed. is there a way to force a reload of image. Thanks
9
2975
by: andrewfelch | last post by:
Hello all, I'm using the metaclass trick for automatic reloading of class member functions, found at: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/160164 My problem is that if I 1) pickle an object that inherits from "AutoReloader" 2) unpickle the object 3) modify one of the pickled' object's derived class methods 4) reload the module holding the class
32
3125
by: C. (http://symcbean.blogspot.com/) | last post by:
Hi all, I have an application which generates image graphs. These cache nicely at the client, however if the user submits more data, I'd like to force a reload of the image from the server. I had a google, but all I could find were suggestions to use a varying query in the URL. This is not a solution to my problem because if I change the page to do that then ALL the graphs will be reloaded every time.
7
3728
by: dragiton | last post by:
SA Upload SQL Database variable types (image upload and storage) I am having trouble with the SA Upload utility. The following code used to work correctly. However, I lost my database and had to rebuild. Does anyone have any suggestions on what I may have wrong. I am not sure if I built my table to store the picture id's correctly. Maybe a field type or something. <form name="UpdatePropertyPicture" method="POST"...
0
1498
by: Alan Baljeu | last post by:
Alan Baljeu http://www.collaborative-systems.org Intelligent software that works _with_ you. ----- Forwarded Message ---- From: Alan Baljeu <alanbaljeu@yahoo.com> To: Mike Driscoll <kyosohma@gmail.com> Sent: Friday, November 14, 2008 2:06:26 PM
0
8420
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
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8740
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
8516
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7353
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
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
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.