471,354 Members | 1,472 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

How do I open a new browser window programmatically?

How do I open and change properties of (such as size, position, scroll
position, visibility of toolbars, etc.) a browser window? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Nov 19 '05 #1
5 7694
Roy
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
nj********@hotmail.com
http://www.nathansokalski.com/


Nov 19 '05 #2
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
nj********@hotmail.com
http://www.nathansokalski.com/

"Roy" <ro**********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
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
nj********@hotmail.com
http://www.nathansokalski.com/

Nov 19 '05 #3
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/a...ods/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" <nj********@hotmail.com> wrote in message
news:uP**************@TK2MSFTNGP12.phx.gbl...
How do I open and change properties of (such as size, position, scroll
position, visibility of toolbars, etc.) a browser window? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

Nov 19 '05 #4
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
nj********@hotmail.com
http://www.nathansokalski.com/

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:OP****************@TK2MSFTNGP14.phx.gbl...
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/a...ods/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" <nj********@hotmail.com> wrote in message
news:uP**************@TK2MSFTNGP12.phx.gbl...
How do I open and change properties of (such as size, position, scroll
position, visibility of toolbars, etc.) a browser window? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/


Nov 19 '05 #5
Roy
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
nj********@hotmail.com
http://www.nathansokalski.com/


Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by lukeo | last post: by
2 posts views Thread by venkatesh | last post: by
10 posts views Thread by Marshall Dudley | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.