SPUG: Forcing a browser to refresh a file

Alan E. Derhaag aderhaa at n2h2.com
Tue Jun 20 17:12:21 CDT 2000


Richard Wood <wildwood_players at yahoo.com> writes:

[...]

> is picking up a cached version of the file.  What can
> I do (from the server's perspective) to force the
> browser to refresh the file?  I suspect it is
> something in the headers I send, like the date for the
> file.  But I can't get anything to work (yet).
> 
> Here are some bits and pieces from the code:
> 
> 
> my $redirect_string = "http://myhome.com/table.xml";
> 
> ($RT,$WT) = (stat("table.xml"))[8,9];
> $tm = localtime($WT);
> $hdate = sprintf
> "%4d%02d%02dT%02d%02d%02dTZD",$tm->year+1900,
> $tm->mon+1, $tm->mday, $tm->hour, $tm->min, $tm->sec;

  $tm->min += 30;		# expires in 30
  if ($tm->min > 60) {
     $tm->hour += 1;
     $tm->min %= 60;
  }
  $xdate = sprintf
    "%4d%02d%02dT%02d%02d%02dTZD",$tm->year+1900,
    $tm->mon+1, $tm->mday, $tm->hour, $tm->min, $tm->sec;
> 
> print ("Location: $redirect_string\n");  
> print ("Date: $htmldate\n");

  print ("Expires: $xdate\n");

> print ("Content-type: text/xml\n\n");

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 For Subscriptions, Email to majordomo at pm.org:  ACTION  spug-list  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email address





More information about the spug-list mailing list