Solved

Refresh image on web browser

Posted on 2014-03-27
4
486 Views
Last Modified: 2014-03-28
Hi Experts,

I generated jfree chart image on web browser and it displays different chart in FireFox when I hit different link, but not in IE9.
Since it is working FF, I am thinking it has something to do caching issue in IE.

This is the source from the popup windows that displays the chart.
I added these in head tag, but didn't help.

<meta Http-Equiv="Cache-Control" Content="no-cache">
<meta Http-Equiv="Pragma" Content="no-cache">
<meta Http-Equiv="Expires" Content="0">
<meta Http-Equiv="Pragma-directive: no-cache">
<meta Http-Equiv="Cache-directive: no-cache">



<map id="imageMap" name="imageMap">
</map>





<html>
<head>
<meta Http-Equiv="Cache-Control" Content="no-cache">
<meta Http-Equiv="Pragma" Content="no-cache">
<meta Http-Equiv="Expires" Content="0">
<meta Http-Equiv="Pragma-directive: no-cache">
<meta Http-Equiv="Cache-directive: no-cache">

<title></title>
</head>




<body>


	

	<img src="http://localhost:8080/xxxx/servlet/ChartViewer" border=0 usemap="#imageMap">

</body>
</html>

Open in new window


Any idea?
0
Comment
Question by:dkim18
  • 2
4 Comments
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 100 total points
ID: 39960519
The problem you're running into is that your code only affects the caching of the main HTML page... and not the cache of the image.  Those are two separate items.  If you change the image name by even one letter in both the file name and the HTML page, you will see the new image.  This is a problem we constantly run into.  CSS and javascript files have this problem also.  Sometimes you have to directly open image, CSS, and javascript files to get the current version.  A first time visitor does not have this problem because they don't have any of the files in their browser cache.
0
 

Author Comment

by:dkim18
ID: 39960526
you mean changing "ChartViewer"?
0
 
LVL 58

Accepted Solution

by:
Gary earned 400 total points
ID: 39960527
One thing you can do is append the src url with a large random number or timestamp each time you generate the page that way the browser will always request a new image e.g.

http://localhost:8080/xxxx/servlet/ChartViewer?randomnumber=1245234
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39960612
Gary's right, if that's a 'generated page' then that's easy to do.  A common method appends a current timestamp to the URL.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now