MsInternetExplorer CGI problem
walter_burleigh at yahoo.de
Tue Jun 15 11:52:52 CEST 2004
> Using Cgihttpserver I put a python this script called time1.py:
> in cgi-bin directory, and when I get localhost:8000/cgi-bin/time1.py 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/time1.py 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: time1.py\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 - http://www.w3.org/Protocols/rfc2616/rfc2616.html.
More information about the Python-list