[thelist] Refresh Brain Teaser....

Anthony Baratta Anthony at Baratta.com
Sat Jun 16 00:18:40 CDT 2001


At 08:17 PM 6/15/2001, you wrote:
>Unless I am mistaken, you have to put the cache header at the bottom of 
>the pages for IE to work all the time.  Right above the close body 
>tag.  Don't remember where I read it at.  Someone correct me if I am wrong.

That was probably an email from me. ;-) I did do that, didn't work.

I fixed it, but not with Javascript. I ended up using a Perl script to 
build my page - but the fix was not Perl specific. I went to Perl so I 
could control the headers directly, without having to use HTTP-EQUIV Meta 
tags. But that was not the solution either. (I even trying using the 
Cache-Control header directives. No go.)

The browser was caching the "link to the Javascript source file", which 
contained the text on the page.

e.g. Here's a simplified version of the html file:

[html]
[head]
         [title]TF.N Popup Headlines/Newsfeed[/title]
     [meta http-equiv="Refresh" content="600; 
URL=http://www.foo.org/dir/popupnews.cgi"]
     [META HTTP-EQUIV="Pragma" CONTENT="no-cache"]
     [META HTTP-EQUIV="Expires" CONTENT="Tue, 04 Dec 1993 21:29:02 GMT"]
[/head]

[body onLoad="self.focus();" bgcolor="white"]
   [div align="center"]
   [SCRIPT LANGUAGE="Javascript" 
SRC="http://www.foo.org/dir/headlines.js"][/SCRIPT]
   [/div]
[/body]
[SCRIPT LANGUAGE="Javascript"]self.focus();[/SCRIPT]
[head]
     [META HTTP-EQUIV="Pragma" CONTENT="no-cache"]
     [META HTTP-EQUIV="Expires" CONTENT="Tue, 04 Dec 1993 21:29:02 GMT"]
[/head]
[/html]

In order to force BOTH Netscape and IE to not cache the page and the items 
on the page, I generated a random number and appended it to the meta 
refresh AND the javascript source link.

e.g.

...

     [meta http-equiv="Refresh" content="600; 
URL=http://www.foo.org/dir/popupnews.cgi?RAN=$varURI"]

...

   [SCRIPT LANGUAGE="Javascript" 
SRC="http://www.foo.org/dir/headlines.js?RAN=$varURI"][/SCRIPT]

...

So each time the script is called a new RAN is created and appended to the 
"links". This appears to fool the browsers (mostly IE) into thinking its 
requesting new content. Even though the expires tags should be telling the 
browsers not to cache ANY of the content on the page. sheesh.

I could probably roll this into a javascript only solution, but I didn't 
want to take any more time on this and just left it as a perl script.

What a broken pile of crap. I should send Redmond a bill for my lost time.
---
Anthony Baratta
President
Keyboard Jockeys

Blatant Plug: Cool Jazz for a hot summer,
     http://LisaMarie.Baratta.com





More information about the thelist mailing list