It must be done before the request is started. It's too late by the time your script executes. By using the target attribute on the <form> or <a> tag, the script specified by the action or href attribute will load in a new window.
<form target="_blank" action="..." ...>
...
</form>
or
<a target="_blank" href="..." ...>...</a>
| [reply] [d/l] [select] |
In the CGI docs, look under the heading "WORKING WITH FRAMES". There's a statement in there that says:
You may provide a -target parameter to the header() method:
print $q->header(-target=>'ResultsWindow');
...
If a frame of that name doesn't already exist, the browser will pop up
+ a new window and load your script's document into that.
...
| [reply] [d/l] [select] |
Interesting. That outputs a non-standard HTTP header. Any idea how well it is supported?
It's not mentioned in the HTML spec either. The only mention I've found on the IETF or W3 sites is to an old draft RFC.
| [reply] |
I tried the suggestions, and here is what I found. Opening a window is not problem when using a form. However, I want this to be automatic, not requiring the viewer to have to click on something. And I haven't found anything that would allow for a n automatic submission of a form.
When I tried using the -target parameter in the header, I couldn't get it to work in either Netscape, Firefox, or Safari. (I didn't bother to test it in IE because it has to work for all common browsers, or not at all.)
On the server I use, there are a ton of CGI packages, and I haven't had time to wade through them all; maybe there is an answer there. I am currently trying to use two CGI objects to see if that would work, but as yet, I haven't found a way to cause them to operate in two different windows. | [reply] |