How to open a HTML file when the python cgi program is executing?
usenet at thinkspot.net
Sat Jun 1 12:20:06 EDT 2002
On Sat, 1 Jun 2002 22:28:34 +1000, "Ken" <ken at hotmail.com> wrote in
comp.lang.python in article <adaeh8$uum7t$1 at ID-49758.news.dfncis.de>:
> > If you realize this before you've output anything, you can use one of the
> > redirection / refresh headers, such as "Location".
> > print """Content-type: text/html
> > Location: http://replacement-url
> > <p><a href="http://replacement-url">Click here</a></p>
> Doesn't seem to work... :(
> > """
You must remove the line about Content-type.
The Location header will essentially redirect to a different HTML page.
When using the location header, your entire output that is printed should
print "Location: http://replacement-url\n"
You should have nothing before this, and there's no point in having
anything after it, since the page is being redirected.
More information about the Python-list