How do I open a new browser window programmatically?

Discussion in 'ASP .Net' started by Nathan Sokalski, Jun 3, 2005.

  1. How do I open and change properties of (such as size, position, scroll
    position, visibility of toolbars, etc.) a browser window? Thanks.
    --
    Nathan Sokalski

    http://www.nathansokalski.com/
     
    Nathan Sokalski, Jun 3, 2005
    #1
    1. Advertising

  2. Nathan Sokalski

    Roy Guest

    Use javascript.

    <SCRIPT LANGUAGE="javascript">window.open('somepage.html')</SCRIPT>

    is the basic syntax.


    Nathan Sokalski wrote:
    > How do I open and change properties of (such as size, position, scroll
    > position, visibility of toolbars, etc.) a browser window? Thanks.
    > --
    > Nathan Sokalski
    >
    > http://www.nathansokalski.com/
     
    Roy, Jun 3, 2005
    #2
    1. Advertising

  3. I know how to open a new window using Javascript, and id I have to manually
    write the Javascript that's OK, but how do I call the Javascript from a
    method in ASP.NET code? For example, I want the new window to open when a
    specific event occurs on my page. (I use VB.NET as my language when making
    my ASP.NET pages) How do I do this? Thanks.
    --
    Nathan Sokalski

    http://www.nathansokalski.com/

    "Roy" <> wrote in message
    news:...
    > Use javascript.
    >
    > <SCRIPT LANGUAGE="javascript">window.open('somepage.html')</SCRIPT>
    >
    > is the basic syntax.
    >
    >
    > Nathan Sokalski wrote:
    >> How do I open and change properties of (such as size, position, scroll
    >> position, visibility of toolbars, etc.) a browser window? Thanks.
    >> --
    >> Nathan Sokalski
    >>
    >> http://www.nathansokalski.com/

    >
     
    Nathan Sokalski, Jun 3, 2005
    #3
  4. You can open windows with the javascript window.open method.
    Here's more info:
    http://SteveOrr.net/articles/ClientSideSuite.aspx
    http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp

    Some popup blockers may foil your plans however, so consider alternate
    designs.

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    "Nathan Sokalski" <> wrote in message
    news:...
    > How do I open and change properties of (such as size, position, scroll
    > position, visibility of toolbars, etc.) a browser window? Thanks.
    > --
    > Nathan Sokalski
    >
    > http://www.nathansokalski.com/
    >
     
    Steve C. Orr [MVP, MCSD], Jun 3, 2005
    #4
  5. I understand everything about the Javascript window.open method and how
    popup blockers may cause problems when using it. This is why I have been
    looking for a way to open a new browser window using ASP.NET without
    manually writing the Javascript. But if I do use Javascript, how do I tell
    ASP.NET code written in VB.NET to call it? The specific purpose I plan to
    use this for is when to open a printable version of a page when the user
    clicks a button. I would rather use an ImageButton control than nest and
    Image control inside of a HyperLink control with a Target property of
    _blank. This way I can use less controls and I would also like to use the
    CommandArgument property of the ImageButton control. Thanks.
    --
    Nathan Sokalski

    http://www.nathansokalski.com/

    "Steve C. Orr [MVP, MCSD]" <> wrote in message
    news:OPITS%...
    > You can open windows with the javascript window.open method.
    > Here's more info:
    > http://SteveOrr.net/articles/ClientSideSuite.aspx
    > http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp
    >
    > Some popup blockers may foil your plans however, so consider alternate
    > designs.
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD, MVP
    > http://SteveOrr.net
    >
    >
    > "Nathan Sokalski" <> wrote in message
    > news:...
    >> How do I open and change properties of (such as size, position, scroll
    >> position, visibility of toolbars, etc.) a browser window? Thanks.
    >> --
    >> Nathan Sokalski
    >>
    >> http://www.nathansokalski.com/
    >>

    >
    >
     
    Nathan Sokalski, Jun 4, 2005
    #5
  6. Nathan Sokalski

    Roy Guest

    I noticed from your other message that you're trying to use ASP.NET to
    open a new window. Long story short: you can't (or at least not in any
    comparably simple way that javascript allows for). Ya gotta use
    javascript.

    I did a job similar to what you're describing not too long ago. I
    placed the javascript syntax within a global VB variable in the
    page_load area. You may already know that VB.NET = server-side and
    javascript = client-side. By placing the javascript within a VB
    variable you get around this and sorta merge the two, but I digress...
    In the button click event (I was using a <asp:buttton> in my job) I did
    a response.write() *using that variable* and thusly passed back the
    javascript back to the client for processing.



    Nathan Sokalski wrote:
    > I know how to open a new window using Javascript, and id I have to manually
    > write the Javascript that's OK, but how do I call the Javascript from a
    > method in ASP.NET code? For example, I want the new window to open when a
    > specific event occurs on my page. (I use VB.NET as my language when making
    > my ASP.NET pages) How do I do this? Thanks.
    > --
    > Nathan Sokalski
    >
    > http://www.nathansokalski.com/
     
    Roy, Jun 4, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Tm92aWNl?=
    Replies:
    2
    Views:
    6,718
    Alan Ferrandiz Langley
    Jun 9, 2004
  2. Shiperton Henethe
    Replies:
    17
    Views:
    5,500
    Deirdre Saoirse Moen
    May 21, 2004
  3. Gordon
    Replies:
    3
    Views:
    343
    Steven Burn
    Apr 16, 2004
  4. raj
    Replies:
    0
    Views:
    213
  5. PC HUA
    Replies:
    2
    Views:
    469
    PC HUA
    May 19, 2004
Loading...

Share This Page