MsInternetExplorer CGI problem

Walter Burleigh walter_burleigh at
Tue Jun 15 11:52:52 CEST 2004

Federico wrote:

> Using Cgihttpserver I put a python this script called
> in cgi-bin directory, and when I get localhost:8000/cgi-bin/ in
> Internet Explorer I can see my localtime...
> then I go around on internet with my browser and when I go again in
> localhost:8000/cgi-bin/ it shows the old time value and I have to
> refresh the page to have the rigth value....
> Can I do something to resolve this problem?

You might try to modify your http-header. Your problem is your browser's
cache, so disabling that cache for your script might work:

print "Content-type: text/html\n"
print "Pragma: no-cache\n\n"

Unfortunately, some browsers don't respect pragma-fields. You might try to
set an explicit expiration date instead:

print "Expires: Thursday, 17-Jun-04 18:32:00 GMT\n"

Unfortunately, some browsers ignore this field, too.

Fortunately, you can instruct your browser to load another page after a
specified amount of time:

print "HTTP/1.1 303 Redirect\n"
print "Location:\n"            # Redirect to URL
print "Retry-After: 60\n"               # Redirect after 60 seconds
print "Content-type: text/html\n\n"

Mostly, this will work.

I hope I remeber the syntax correctly. You may want to have a look at
RFC 2616 -



More information about the Python-list mailing list