Results 1 to 10 of 10

Thread: Redirect to URL in a new window?

  1. #1

    Thread Starter
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Redirect to URL in a new window?

    In VB.NET code in an ASP.NET project, I can call:
    VB Code:
    1. Response.Redirect("NewPage.apsx")
    And this directs me to "NewPage.aspx" in my current browser window. But how can I open this URL in a new window rather than the current one?
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

  2. #2
    Hyperactive Member GlenW's Avatar
    Join Date
    Nov 2001
    Location
    Gateshead, England
    Posts
    479

    Re: Redirect to URL in a new window?

    You can only open a new window client-side, so send a javascript inline command via the buffer.
    Last edited by GlenW; Apr 19th, 2005 at 10:31 AM. Reason: Bad spelling

  3. #3

    Thread Starter
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Re: Redirect to URL in a new window?

    That's ridiculous!?!

    My form is serverside, therefore all my controls are serverside. You mean I can't possibly open in a new window then?
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

  4. #4
    Hyperactive Member GlenW's Avatar
    Join Date
    Nov 2001
    Location
    Gateshead, England
    Posts
    479

    Re: Redirect to URL in a new window?

    Sorry that's the way it is, but sending inline javascript only takes a couple of lines of code.

  5. #5

    Thread Starter
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Re: Redirect to URL in a new window?

    Quote Originally Posted by GlenW
    Sorry that's the way it is, but sending inline javascript only takes a couple of lines of code.
    Can I do that from a webcontrol button that is run at the server?
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

  6. #6
    Hyperactive Member GlenW's Avatar
    Join Date
    Nov 2001
    Location
    Gateshead, England
    Posts
    479

    Re: Redirect to URL in a new window?

    Yes just send the javascript via Response.Flush after putting the script in the Buffer.
    Make sure you pad the buffer first 'cos it won't flush if its contents are too small and your script will be too small.

  7. #7

    Thread Starter
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Re: Redirect to URL in a new window?

    Do you know if it works with vbscript?

    Using the buffer is completely new to me...any code example would be greatly appreciated...
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

  8. #8
    Hyperactive Member GlenW's Avatar
    Join Date
    Nov 2001
    Location
    Gateshead, England
    Posts
    479

    Re: Redirect to URL in a new window?

    Code:
    Response.Write("<script language=javascript>window.open('PageToOpen.aspx',null, 'height=550, width=800, status=no, toolbar=no, menubar=no,  location=no');</script>");
    Response.Flush();
    This is for javascript in C# shouldn't be too hard to port.

  9. #9
    Hyperactive Member GlenW's Avatar
    Join Date
    Nov 2001
    Location
    Gateshead, England
    Posts
    479

    Re: Redirect to URL in a new window?

    Also my syntax may be awry as haven't been able to test it.

  10. #10

    Thread Starter
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Re: Redirect to URL in a new window?

    I see. Thankyou very much!
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

Posting Permissions

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



Click Here to Expand Forum to Full Width