Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks,

I use the below code using CGI::Application. It will redirect and the given excel file opening in the same window for me. I want to open in new window. so, plz. help me the parameters to hash what i have to give.. Thanks in Advance.

$self->header_type('redirect'); $self->header_props( -type => 'application/vnd.ms-excel', '-Content-Disposition' => "attachment;filename=$global_filenam +e", -url => $global_filename );

Considered: idsfa: Unapprove (edit) this node. It is massively OT.

Unconsidered: g0n - enough keep votes ( Keep: 11, Edit: 4, Reap: 4 )

Replies are listed 'Best First'.
Re: How to open a New window?
by dorward (Curate) on Dec 07, 2005 at 10:56 UTC

    This is not a Perl problem, this is an HTTP problem.

    There is no way, in HTTP to specify "Go back to the previous URL and open a new window for this other URL" (nor, for that matter, any way to open a new window in HTTP period).

    You might generate an HTML document with some JavaScript that opens a popup and then goes back in the history - but that's a hidious solution.

    You could also assume that if the user has their browser configured to open Excel documents in a browser window, that they can choose to open a new window (or tab) when they want, and are capable enough to use the back button if they want to go back to the previous URL.

Re: How to open a New window?
by kulls (Hermit) on Dec 07, 2005 at 11:00 UTC
    I guess you call your script (.pl) file through hyperlink and if so, there you can specify your 'TARGET' as new window.
    -kulls
Re: How to open a New window?
by kprasanna_79 (Hermit) on Dec 07, 2005 at 11:11 UTC
    Hi,

    I am not sure how your code and logic goes. But Your issue should be solved with help of javascript, thats what my understanding is. so see below piece of code, and get some idea from it. Kindly excuse if it doesnt resolves.

    function pop_up() { var win = window.open("", "new_window", "status=1,resizable=1,scrollbars=1,width=510 +,height=418"); win.location = "code.pl?rm=display_excel"; win.focus(); }

    Kindly change the attributes and its values accordingly.

    -Prasanna.k
      Hi kprasanna_79,

      I use submit there also. so, there i can't using the above what to do ?

Re: How to open a New window?
by g0n (Priest) on Dec 07, 2005 at 17:30 UTC
    Alternative explanation:

    You asked what parameters you could put in the snippet you posted to make the browser open a new window. There aren't any parameters that will do that.

    When this bit of code is called, the browser is asking for something to display - it's already too late to leave the previous page intact and display this one in a separate window.

    To get the document to display in a separate window, you need to change the previous page .

    For example, as kulls said, if this redirect is called by a URL, you can change the TARGET in the url. Alternatively, as kprasanna_79 suggested, you can put some javascript into the page that calls this code - perhaps a button that 'onClick' calls the function kprasanna_79 showed you.

    --------------------------------------------------------------

    "If there is such a phenomenon as absolute evil, it consists in treating another human being as a thing."

    John Brunner, "The Shockwave Rider".

Re: How to open a New window?
by Perl Mouse (Chaplain) on Dec 07, 2005 at 11:14 UTC
    It's the same as you would do from a C program. So you might want to ask at C-monks.
    Perl --((8:>*