473,654 Members | 2,990 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Forcing a browser to re-render an image from its URL location andnot from the browser's cache

Is there a way in Javascript, or perhaps in HTML, to force a browser to
re-render an image on an HTML page after a round-trip between the client
and the server ?

In my particular case, the image is changing on the server although the
URL for it remains the same, but the browser is still displaying the old
image from its cache rather than the new image from its URL location.
Oct 23 '07 #1
8 4047
Edward Diener <di************ ***********@bel lsouth.netwrote in
news:3I******** ********@bignew s1.bellsouth.ne t:
Is there a way in Javascript, or perhaps in HTML, to force a browser to
re-render an image on an HTML page after a round-trip between the client
and the server ?

In my particular case, the image is changing on the server although the
URL for it remains the same, but the browser is still displaying the old
image from its cache rather than the new image from its URL location.
you can try appending fake arguments to the URL, ie:

<img src="naked.jpg? blahblah" />

Oct 23 '07 #2
Good Man wrote:
Edward Diener <di************ ***********@bel lsouth.netwrote in
news:3I******** ********@bignew s1.bellsouth.ne t:
>Is there a way in Javascript, or perhaps in HTML, to force a browser to
re-render an image on an HTML page after a round-trip between the client
and the server ?

In my particular case, the image is changing on the server although the
URL for it remains the same, but the browser is still displaying the old
image from its cache rather than the new image from its URL location.

you can try appending fake arguments to the URL, ie:

<img src="naked.jpg? blahblah" />
Thanks, but that does not work.

Is it not a bug in a browser if the browser never re-renders an image
except from its cache, or is that just the way certain browsers work ?

If certain browsers work that way surely there must be some way to tell
a browser to re-render the image because the image has changed between
the trip between the client and server and back. Do all modern browsers
just assume that an image in an HTML page must remain static and never
change once it is displayed during a session, and strictly rely on the
end-user to tell the browser to refresh the entire HTML page when
necessary through some sort of menu command ?
Oct 23 '07 #3
Friedemann Kiersch wrote:
>>you can try appending fake arguments to the URL, ie:
<img src="naked.jpg? blahblah" />
Thanks, but that does not work.

Actually, it _does_ work if you apply a random
number/string as the fake argument, changing its
value on _every_ page impression.
It does also work with cache control headers, which don't fill the cache
which garbage, and don't reduce access speed to other resources, effectively.

http://www.mnot.net/cache_docs/
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8************ *******@news.de mon.co.uk>
Oct 23 '07 #4
Thomas 'PointedEars' Lahn wrote:
Friedemann Kiersch wrote:
>>>you can try appending fake arguments to the URL, ie:
<img src="naked.jpg? blahblah" />

Thanks, but that does not work.
Actually, it _does_ work if you apply a random
number/string as the fake argument, changing its
value on _every_ page impression.

It does also work with cache control headers, which don't fill the cache
which garbage, and don't reduce access speed to other resources, effectively.

http://www.mnot.net/cache_docs/
PointedEars
We are using the HTML below, to no effect. The actual problem is an
image URL being displayed on an HTML page using IE7.

<META HTTP-EQUIV="Expires" CONTENT="Tue, 01 Jan 1985 00:00:01 GMT">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="cache-control" CONTENT="no-cache, no-store,
must-revalidate">
<html xmlns="http://www.w3.org/1999/xhtml">

The actual image, to which the URL points, is being changed between
client-server roundtrips, but even with the HTML code above for the HTML
page, IE7 just refuses to re-render the image but insists on always
grabbing it from its cache and therefore not displaying the updated image.
Oct 24 '07 #5
Edward Diener wrote:
Friedemann Kiersch wrote:
>>>you can try appending fake arguments to the URL, ie:
<img src="naked.jpg? blahblah" />

Thanks, but that does not work.
Actually, it _does_ work if you apply a random
number/string as the fake argument, changing its
value on _every_ page impression.

Perhaps in your case this works but in my case it does not.

Are you saying that the argument string after the URL
It is _not_ after the URL/URI, but (the query) part of it. See RFC3986.
has to be a numeric string to work as opposed to just any random string ?
More, `blahblah' (the query part) in this example should contain a value
that is unique over time.

With client-side JS/ES,

(new Date()).getTime ()

or (slightly more efficient)

(new Date()).valueOf ()

provide that. Just in case you find no way with your server to send cache
control headers or you find your currently unknown target UA ignoring them
(keep in mind that not all UAs support HTTP/1.1, so you should send the
cache control headers defined in HTTP/1.0, too).
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Oct 24 '07 #6
Edward Diener wrote:
[...]
Ok, thanks for the heads-up about using actual cache control headers
rather than meta elements. I am using an NSAPI based C++ web server
environment ( in my job ) and I will now try to figure out how to
generate the correct cache control headers when sending a page back to
the client.
Even with correctly configured headers, you have no iron guarantee
that every visiting browser (or server, or any in between gateways)
will obey the rules. For example, ISPs looooove to buffer because it
can save them a lot of money on traffic. I would take one of the
suggested randomizers for maximum result.

--
Bart

Oct 25 '07 #7
Bart Van der Donck wrote:
Edward Diener wrote:
>[...]
Ok, thanks for the heads-up about using actual cache control headers
rather than meta elements. I am using an NSAPI based C++ web server
environment ( in my job ) and I will now try to figure out how to
generate the correct cache control headers when sending a page back to
the client.

Even with correctly configured headers, you have no iron guarantee
that every visiting browser (or server, or any in between gateways)
will obey the rules. For example, ISPs looooove to buffer because it
can save them a lot of money on traffic. I would take one of the
suggested randomizers for maximum result.
Unforunately neither using the correct cache control headers nor using
the randomizer technique is working in my case. The only thing left to
try is to randomly generate an entirely different image src name for
each round-trip.
Oct 25 '07 #8
[Sorry for posting out of thread but this FUD has to be corrected.]
Bart Van der Donck wrote:
>Edward Diener wrote:
>>[...]
Ok, thanks for the heads-up about using actual cache control headers
rather than meta elements. I am using an NSAPI based C++ web server
environment ( in my job ) and I will now try to figure out how to
generate the correct cache control headers when sending a page back to
the client.
Even with correctly configured headers, you have no iron guarantee
that every visiting browser
True. The client will have to support at least HTTP/1.0. However,
HTTP/0.9-only clients are a rare commodity nowadays.
>(or server, or any in between gateways) will obey the rules.
The server does not have to obey the rules, but the client has to. The
gateway would have to work at the application level to recognize and
filter out HTTP headers. No gateway that works at the application level
will do the latter.
>For example, ISPs looooove to buffer because it can save them a lot
of money on traffic.
Those ISPs will become bankrupt soon because no customer likes it if their
Reload button does not work at all. Proxy caches as employed by ISPs cache
Web data based on the full URI, so the case you describe here is not at all
realistic.
PointedEars
Oct 25 '07 #9

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

Similar topics

0
2011
by: Hugh Lutley | last post by:
I'm trying to install the Device::SerialPort module using CPAN but whilst CPAN is running 'make test' a couple of errors are flagging so I cannot continue the install without forcing it. I'm not too worried about the errors as the success rate is still around 99.7 percent. Anyway, so how do I force the install?? I tried -f and --force options after install but they aren't recognised.... Cheers
12
3678
by: Ritz, Bruno | last post by:
hi in java i found that when a method has a throws clause in the definition, callers must either handle the exceptions thrown by the method they are calling or "forward" the exception to the caller by specifying a throws clause as well. is there a similar machanism in c++? i want to force a developer to write handlers for all possible exceptions a method of my class library can throw.
1
2667
by: John M | last post by:
Hello All, The code below is something I have been working on and just can't get past. I know it must be very simple but here goes. The Form Method line text is invisible on browers, but still forcing a space betweem the graphics and the forms. How do I make the Form Method line function, but not require space on the page? Code is below, take a look ans see for yourselves... I appreciate any help.
6
7714
by: Finn Newick | last post by:
By defining a style as follows: @media aural, handheld {td.layout {display:block;}} I'm hoping to linearise layout tables when viewed by screenreaders and handheld devices (it is also be in some selectable user preferences). This works as intended in Netscape 7 - all the cells stack vertically above each other nicely, but not in Internet Explorer 6 where the only display property that td will respond to seems to be 'none'.
40
3030
by: Neo The One | last post by:
I think C# is forcing us to write more code by enforcing a rule that can be summarized as 'A local variable must be assgined *explicitly* before reading its value.' If you are interested in what I mean, please look at this feedback my me: http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=3074c204-04e4-4383-9dd2-d266472a84ac If you think I am right, please vote for this feedback.
12
3256
by: Howard Kaikow | last post by:
In the code below, ALL the lines that start with PPTfile << are getting the following error at build time. "//i:\C++\C++Code\FileOperations\Form1.h(127) : warning C4800: 'System::String __gc *' : forcing value to bool 'true' or 'false' (performance warning)" I get the following output, which is obviously wrong: Process ID = 0x1
0
1942
by: steve | last post by:
SysInternals provides a *FANTASTIC* product called DebugView. It allows you to snoop User and Kernel traces, eg. You can view Trace.WriteLine etc It also timestamps the traces. I deal a lot with proprietary comms protocols, so these timestamps are valuable. When I'm running under the VS debugger, Trace output is redirected to the "Output" window. Unfortunately, it appears that VS intercepts the traces so that they don't appear in...
2
1312
by: Scott | last post by:
Are there any div attributes that could force a div element to stay in the background? I have a .vbs calendar class that opens a small calendar. Unfortunately, sometimes it opens above a form element like a combo box and the combo box shows on top of my calendar. The combo in question happens to be within div tags because it hides/appears depending on another form choice. Any got any good links on forcing div elements to the background?
3
2476
by: eross | last post by:
Noob here, I am trying to manage calls from multiple clients to my web service by only letting one execute at a time and forcing the others to wait. Code is as follows: ------------------------------ <WebMethod()> Public Function myFunction(ByVal sXMLData As String) As String
4
1530
by: teeBull | last post by:
Hi all, We'd like to take advantage of code we already have for transforming XML into HTML (using XSLT) for our users to save the HTML as an MS Word document locally. I've dug around and found the following code to include in the code behind: Response.ContentType = "application/vnd.ms-word" Response.AddHeader("Content-Disposition", "inline;filename=someFile.doc")
0
8290
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
8815
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
8707
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
8482
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,...
1
6161
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
5622
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
4149
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
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2714
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

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.