MsInternetExplorer CGI problem

F

Federico

Using Cgihttpserver I put a python this script called time1.py:

import time
print "Content-Type: text/html\n\n"
print '<html>\n<body>\n'
print time.localtime()
print '</body></html>'

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?
PS: under Linux with Netscape it works well without refreshing the page....
 
W

Walter Burleigh

Federico said:
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.

Best

Walter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,201
Messages
2,571,049
Members
47,655
Latest member
eizareri

Latest Threads

Top