Professional Web Applications Themes

new window on redirect - PERL Beginners

I want my web page redirect to open in a new window, as if I were putting "target=_new" in the html of the URL. How can I do that using CGI.pm's redirect? I have this: print $output->redirect($u) with $u being the URL I am redirecting, too. Thanks, Tim -- Tim McGeary edu...

  1. #1

    Default new window on redirect

    I want my web page redirect to open in a new window, as if I were
    putting "target=_new" in the html of the URL. How can I do that using
    CGI.pm's redirect? I have this:

    print $output->redirect($u)

    with $u being the URL I am redirecting, too.

    Thanks,
    Tim

    --
    Tim McGeary
    edu


    Tim Guest

  2. #2

    Default Re: new window on redirect


    On 13 Jul 2004, at 14:37, Tim McGeary wrote:
     

    Which isn't allowed under HTML. You are probably thinking of _blank.
    http://www.w3.org/TR/html4/types.html#h-6.16
     

    You can't... well... there is the Window-Target not-really-http-header
    but, last I heard, browser support for that (thankfully) s.
    http://diveintoaccessibility.org/day_16_not_opening_new_windows.html

    --
    David Dorward
    <http://dorward.me.uk/>
    <http://blog.dorward.me.uk/>

    David Guest

  3. #3

    Default Re: new window on redirect

    > I want my web page redirect to open in a new window, as if I were 

    The problem is that the redirect is providing an HTTP header back with
    the new location and a result code that instructs the browser to find
    the page at the new location, this is working at the protocol level
    which has no knowledge of windows, targets, etc. So using 'redirect' is
    not likely to get you anywhere at the client level.

    Generally I would think your best bet would be to have the link itself
    use a standard target, which for some reason you seem to be avoiding,
    reasons? Alternatively you could pass back some javascript for the
    onLoad handler and have it pop the new redirect in a new window, but the
    problem I see here is that the browser will have already cleared the
    window's contents and "loaded" a new page, so the same handler would
    need to restore the previous contents, which gets real ugly, especially
    if the referer is POST'ed. I wouldn't even want to think about the
    nightmares dealing with different versions of browsers + javascript,
    etc. However if your referer is static and you can guarantee it then it
    wouldn't be as much of a problem.

    http://danconia.org
    Wiggins Guest

  4. #4

    Default Re: new window on redirect

    Sorry, I didn't mean to not include everyone on my reply...

    The reason I need a new window (and I did actually mean _blank), is
    because this is for a Library portal site which has a limited window
    view. Our users actually (almost) demand a new window because they
    don't want to have to hit their back button 20 times to get back to
    their customized list of electronic Library resources.

    And so, if I don't open a new window, then they will complain that they
    cannot see the site they want to see (because the window is too small)
    and they have now lost their portal site, which they need to open other
    sites in order to compare for their research, etc.

    I am modifying current open sourced software that's already in place,
    though not yet in production mode for our users.

    Does that help explain why I need it? What would you suggest at this point?

    Thanks,
    Tim

    Tim McGeary
    Senior Library Systems Specialist
    Lehigh University
    610-758-4998
    edu



    Wiggins d Anconia wrote: 
    >
    >
    > The problem is that the redirect is providing an HTTP header back with
    > the new location and a result code that instructs the browser to find
    > the page at the new location, this is working at the protocol level
    > which has no knowledge of windows, targets, etc. So using 'redirect' is
    > not likely to get you anywhere at the client level.
    >
    > Generally I would think your best bet would be to have the link itself
    > use a standard target, which for some reason you seem to be avoiding,
    > reasons? Alternatively you could pass back some javascript for the
    > onLoad handler and have it pop the new redirect in a new window, but the
    > problem I see here is that the browser will have already cleared the
    > window's contents and "loaded" a new page, so the same handler would
    > need to restore the previous contents, which gets real ugly, especially
    > if the referer is POST'ed. I wouldn't even want to think about the
    > nightmares dealing with different versions of browsers + javascript,
    > etc. However if your referer is static and you can guarantee it then it
    > wouldn't be as much of a problem.
    >
    > http://danconia.org
    >[/ref]

    Tim Guest

  5. #5

    Default Re: new window on redirect

    Please bottom post...
     

    Ah, I love tab capable browsers ;-). (I know it is unreasonable to force
    your users to use one.)
     

    Not entirely sure why this is determined after the script has been
    called though? Why not have the list of links modified to force a new
    target on the initial link rather than on submission?
     
    point?

    <snip>

    Sort of. What I don't understand is why do you have to decide on the
    server side, post-request that the result will be in a new window?
    Couldn't the original "portal" page just use targets like normal?

    http://danconia.org

    Wiggins Guest

  6. #6

    Default Re: new window on redirect

    Wiggins d Anconia wrote: 

    I hate bottom posting... but alas... scroll down. :)
     
    >
    >
    > Ah, I love tab capable browsers ;-). (I know it is unreasonable to force
    > your users to use one.)
    >

    >
    >
    > Not entirely sure why this is determined after the script has been
    > called though? Why not have the list of links modified to force a new
    > target on the initial link rather than on submission?
    >

    >
    > point?
    >
    > <snip>
    >
    > Sort of. What I don't understand is why do you have to decide on the
    > server side, post-request that the result will be in a new window?
    > Couldn't the original "portal" page just use targets like normal?[/ref]

    It's a database driven site and so, unfortunately, it is all server
    side, at least for this purpose. So are you telling me there's no real
    way in perl to do this?

    Tim

    Tim McGeary
    Senior Library Systems Specialist
    Lehigh University
    610-758-4998
    edu





    Tim Guest

  7. #7

    Default Re: new window on redirect

    Please group reply so others can help and be helped.
     
    >
    > I hate bottom posting... but alas... scroll down. :)
    >[/ref]

    Yes but it makes it easier to follow (you can always snip so as not to
    force a long scroll)....
     [/ref][/ref]

    You did the last time but not this time, hmph.

    <snip>
     
    >
    > It's a database driven site and so, unfortunately, it is all server
    > side, at least for this purpose. So are you telling me there's no real
    > way in perl to do this?
    >[/ref]

    Right, but again, assuming the page they are linking from is driven then
    set the target at the time of the original display rather than during
    the link through? Aka the user goes to the site, is presented a list of
    links that are from search results, I am assuming they will click one of
    those links to see a detail listing, seeing that detailed listing in a
    new window is what you are after? Rather than trying to set the new
    window after the click, you set it when the list is presented
    originally. Perl isn't really involved in this because it is running on
    the server side, other than you will need to modify how your original
    result page (the one they click on) is displayed.

    http://danconia.org
    Wiggins Guest

  8. #8

    Default RE: new window on redirect

    Tim McGeary <EDU> asked: [/ref]
     

    Actually, there is no real way to do that in any
    programming language. It's not a Perl-specific issue.

    HTH,
    Thomas
    Thomas Guest

  9. #9

    Default Re: new window on redirect


    Wiggins d Anconia wrote:
    <snip>
     
    >>
    >>It's a database driven site and so, unfortunately, it is all server
    >>side, at least for this purpose. So are you telling me there's no real
    >>way in perl to do this?[/ref]
    >
    > Right, but again, assuming the page they are linking from is driven then
    > set the target at the time of the original display rather than during
    > the link through? Aka the user goes to the site, is presented a list of
    > links that are from search results, I am assuming they will click one of
    > those links to see a detail listing, seeing that detailed listing in a
    > new window is what you are after? Rather than trying to set the new
    > window after the click, you set it when the list is presented
    > originally. Perl isn't really involved in this because it is running on
    > the server side, other than you will need to modify how your original
    > result page (the one they click on) is displayed.[/ref]

    That won't work (just tried it). I cannot set a target in the DB.

    [sigh]

    Tim Guest

  10. #10

    Default Re: new window on redirect

    Tim McGeary wrote on 13.07.2004:
     
    >>
    >>Right, but again, assuming the page they are linking from is driven
    >>then set the target at the time of the original display rather than
    >>during the link through? Aka the user goes to the site, is
    >>presented a list of links that are from search results, I am
    >>assuming they will click one of those links to see a detail
    >>listing, seeing that detailed listing in a new window is what you
    >>are after? Rather than trying to set the new window after the
    >>click, you set it when the list is presented originally. Perl isn't
    >>really involved in this because it is running on the server side,
    >>other than you will need to modify how your original result page
    >>(the one they click on) is displayed.[/ref]
    >
    >That won't work (just tried it). I cannot set a target in the DB.
    >[/ref]

    Sorry, if I do not get you right, but... can't your script provide a link list like this:

    <ul>
    <li><a href="detail.pl?id=1234" target="_blank">Item 1234</a></li>
    <li><a href="detail.pl?id=1235" target="_blank">Item 1235</a></li>
    <li><a href="detail.pl?id=1236" target="_blank">Item 1236</a></li>
    <li><a href="detail.pl?id=1237" target="_blank">Item 1237</a></li>
    </ul>

    This is what Wiggins meant when writing "modify your original results page"(as far as I understand him). It has nothing to do with the database nor with Perl. But it works, opening a new window when the user clicks on a link.

    - Jan
    --
    Hanlon's Razor: Never attribute to malice that which can be adequately explained by stupidity.
    Jan Guest

  11. #11

    Default Re: new window on redirect


    Jan Eden wrote: 
    >>
    >>That won't work (just tried it). I cannot set a target in the DB.
    >>[/ref]
    >
    >
    > Sorry, if I do not get you right, but... can't your script provide a link list like this:
    >
    > <ul>
    > <li><a href="detail.pl?id=1234" target="_blank">Item 1234</a></li>
    > <li><a href="detail.pl?id=1235" target="_blank">Item 1235</a></li>
    > <li><a href="detail.pl?id=1236" target="_blank">Item 1236</a></li>
    > <li><a href="detail.pl?id=1237" target="_blank">Item 1237</a></li>
    > </ul>
    >
    > This is what Wiggins meant when writing "modify your original results page" (as far as I understand him). It has nothing to do with the database nor with Perl. But it works, opening a new window when the user clicks on a link.
    >
    > - Jan[/ref]

    Actually, I later realized this and indeed am looking into that
    possibility. :) I guess I should have responded as such. Thank you
    for the reminder.

    Tim

    Tim McGeary
    Senior Library Systems Specialist
    Lehigh University
    610-758-4998
    edu



    Tim Guest

  12. #12

    Default Re: new window on redirect


    > >
    > >
    > > Sorry, if I do not get you right, but... can't your script provide a[/ref][/ref]
    link list like this: [/ref]
    results page" (as far as I understand him). It has nothing to do with
    the database nor with Perl. But it works, opening a new window when the
    user clicks on a link. 
    >
    > Actually, I later realized this and indeed am looking into that
    > possibility. :) I guess I should have responded as such. Thank you
    > for the reminder.
    >[/ref]

    Yeh that is what I was getting at, obviously didn't do the best job
    explaining :-). (Tim, since you mentioned it was OSS I assumed you
    could manipulate the link providing script.) If *all* else fails you
    could always wrap the script call to the DB, with a second 'proxy'
    script that calls the original page, ps it, and dynamically adds the
    targets, but this is very *icky* compared to just modifying the original
    source.

    http://danconia.org
    Wiggins Guest

Similar Threads

  1. Create new window on Redirect?
    By bthouin in forum Dreamweaver AppDev
    Replies: 2
    Last Post: March 22nd, 12:07 AM
  2. redirect to guest if first redirect is doesnt work for a user
    By istalcup@hotmail.com in forum Coldfusion - Advanced Techniques
    Replies: 0
    Last Post: March 17th, 03:27 PM
  3. Response.Redirect to a new browser window?
    By Jules Lucas in forum ASP.NET General
    Replies: 2
    Last Post: August 8th, 05:56 PM
  4. Replies: 2
    Last Post: July 26th, 10:53 PM
  5. Replies: 1
    Last Post: July 1st, 03:33 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139