Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem expiring page 1

Status
Not open for further replies.

mhamilton3

Programmer
Oct 31, 2001
129
Hello,
I am attempting to get a page to expire and I am having trouble with proxy servers. I use the following meta tags and I can not think of anything else to get the page to expire. I do not have any control over the proxy server. Do you have any suggestions?

Code:
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<meta http-equiv=&quot;Pragma&quot; content=&quot;no-cache&quot;>
<meta http-equiv=&quot;expires&quot; content=&quot;0&quot;>
<meta http-equiv=&quot;Cache-Control&quot; content=&quot;no-cache, must-revalidate, no-store&quot;>

- Mark
 
My understanding is that each file served up across the internet is preceded by a set of headers that define, amongst other things, how long the file can be cached.

The <meta http_equiv=... tag tells the recipient of an (X)HTML file &quot;pretend that you got these headers as well as/instead of the ones that were really sent&quot;. Web browsers have to parse the HTML to display the page, so they (should) always respect such <meta> tags. A proxy server may well not bother to parse the contents of the file, and would thus ignore whatever you put in <meta> tags.

If I'm right, you'll need to configure your web server to actually send the appropriate headers - just don't ask me how!

-- Chris Hunt
 
Yuck, that is definitely not the answer I was hoping for. I hate to think about doing this at the Apache level because I only want this one page to not be cached. I will keep on searhing...
 
Hi Mark,

I had the same problem with a server side file. It contained an image that were updated but kept the same name but changed appearence. I tried all the tags I could find to prevent caching but none did the trick.

However, I got a solution in the PHP forum. I tried to translate it into a javascript, that *may* work for you...?!

It is only applicable if you have an image in your page!

The trick is to put a parameter behind an image src name (which in fact doesn't make any sense). It works fine in IE which means that the browser actually thinks that it is a new page! Don't know how it will work for you...

Give it a try:

Code:
<HTML>
<HEAD>
  <TITLE>Forcing Refresh?</TITLE>
  <SCRIPT LANGUAGE=&quot;JavaScript&quot;>
    function randomExt() {
      randomNumber = Math.floor(Math.random() * 65535);
      document.write('<IMG SRC=&quot;pic.jpg?randomizer=' + randomNumber + '&quot;>');
    }
  </SCRIPT>
</HEAD>

<BODY>

  <SCRIPT LANGUAGE=&quot;JavaScript&quot;>
    randomExt();
  </SCRIPT>

  <HR>
  Does this work?

</BODY>
</HTML>

Let hear how it turned out!

Good Luck §;O)


Jakob
 
Your solution makes sense to me conceptually for local caching. Local cache will compare contents on your current machine with contents on the server. If they appear to be different, it will get a new file. I think in your case, you did not change the page itself so when it was making it's comparison it said &quot;they are the same&quot;. When you put in the random number generator, it must tell show the local cache that they are different.

I think my only solution is to write this into a scripting language so there is no way it can cache it. Thanks
 
Why not just do a meta refresh once when the page is first visited using java-script (ick) or Sessions?
 
I did not even think about that. I will give that one a try.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top