open a new window without javascript and without hyperlink

D

Dan

hello all,
is there a way to open a new window without javascript and a href=_blank?
i need to connect a button click with some lines of code and then, a new
window shall get opened.
but i didn't find a way to opüen a new window as result of a buttonm click.

thanks for help,
dan
 
M

Matt Berther

Hello dan,

You'll need to either use javascript, or an anchor tag with a target=_blank.

Either: window.open('someURL') or <a href="someURL" target="_blank">

You can not open a window from the server, as the server has no concept of
a browser. The only thing you can do from the server is render code (as above)
to do this on the client.
 
M

Martin Eyles

Dan said:
is there a way to open a new window without javascript and a href=_blank?
i need to connect a button click with some lines of code and then, a new
window shall get opened.
but i didn't find a way to opüen a new window as result of a buttonm
click.

you could make the button a submit button in a form, and have the target of
the form set to _blank (see example below, and see
http://www.w3.org/TR/html4/interact/forms.html for more on the syntax.), or
you could 'fake' a button, by using and image of a button as a link.

eg. 1
<form action="http://somesite.com/somepage.html" method="post"
target="_blank">
<input type="submit" value="Send" />
</form>

eg. 2
<a href="http://somesite.com/somepage.html" target="_blank">
<img src="fakeButton.png" alt="I'm a Button, Honest" />
</a>
 
K

Kevin Spencer

Put a big block of text in your page that says "Open a new browser and go to
the following URL in it: Your URL". If you're lucky, some of your users will
do it. Otherwise, use a link, or JavaScript.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
 
K

Kevin Spencer

I'm thinking that there must be some reason why you don't want to use
JavaScript. Perhaps it's because you have some server-side processing to do,
which necessitates a PostBack, and you don't hink you can open a new window
once the page reloads. But you can. Just add the script using
Page.RegisterStartupScript().

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
 
B

bruce barker

popup blockers prevent this approach - so I'd avoid it.

-- bruce (sqlwork.com)


| I'm thinking that there must be some reason why you don't want to use
| JavaScript. Perhaps it's because you have some server-side processing to
do,
| which necessitates a PostBack, and you don't hink you can open a new
window
| once the page reloads. But you can. Just add the script using
| Page.RegisterStartupScript().
|
| --
| HTH,
| Kevin Spencer
| .Net Developer
| Microsoft MVP
| Neither a follower
| nor a lender be.
|
| | > hello all,
| > is there a way to open a new window without javascript and a
href=_blank?
| > i need to connect a button click with some lines of code and then, a new
| > window shall get opened.
| > but i didn't find a way to opüen a new window as result of a buttonm
| click.
| >
| > thanks for help,
| > dan
|
|
 
K

Kevin Spencer

Well, Bruce, as you know, there are precisely THREE ways to open a new
browser window:

1. JavaScript
2. Target frame of hyperlink or form submit
3. Get the User to do it.

Which way would you use?

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
 
D

Dan

the expectation was that the site must work with disabled js.
and i don't want to use a link because before the new window will open,
some server side action must be performed with data of the actual window.
also, i cannot set the form target because not all the web controls have
to perform a new page being opened.
ok, then i have to take a two step navigation:
1. button event takes starts server side action
2. link click opens new window
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top