Thursday, March 22, 2012

open a new window without javascript and without hyperlink

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 open a new window as result of a buttonm click.
thanks for help,
danHello dan,
You'll need to either use javascript, or an anchor tag with a target=_blank.
Either: window.open('someURL') or <a href="http://links.10026.com/?link=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 abov
e)
to do this on the client.
Matt Berther
http://www.mattberther.com

> 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 open a new window as result of a buttonm
> click.
> thanks for help,
> dan
"Dan" <daniel.maier@.zdv.uni-tuebingen.de> wrote:-
> 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 open 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://links.10026.com/?link=http://somesite.com/somepage.html" target="_blank">
<img src="http://pics.10026.com/?src=fakeButton.png" alt="I'm a Button, Honest" />
</a>
Martin Eyles
martin.eyles@.NOSPAM.bytronic.com
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.
"Dan" <daniel.maier@.zdv.uni-tuebingen.de> wrote in message
news:cnvogh$kgj$1@.newsserv.zdv.uni-tuebingen.de...
> 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 open a new window as result of a buttonm
click.
> thanks for help,
> dan
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.
"Dan" <daniel.maier@.zdv.uni-tuebingen.de> wrote in message
news:cnvogh$kgj$1@.newsserv.zdv.uni-tuebingen.de...
> 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 open a new window as result of a buttonm
click.
> thanks for help,
> dan
popup blockers prevent this approach - so I'd avoid it.
-- bruce (sqlwork.com)
"Kevin Spencer" <kspencer@.takempis.com> wrote in message
news:uch70dY0EHA.4028@.TK2MSFTNGP15.phx.gbl...
| 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.
|
| "Dan" <daniel.maier@.zdv.uni-tuebingen.de> wrote in message
| news:cnvogh$kgj$1@.newsserv.zdv.uni-tuebingen.de...
| > 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 open a new window as result of a buttonm
| click.
| >
| > thanks for help,
| > dan
|
|
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.
"bruce barker" <nospam_brubar@.safeco.com> wrote in message
news:efWjMnZ0EHA.3588@.TK2MSFTNGP14.phx.gbl...
> popup blockers prevent this approach - so I'd avoid it.
> -- bruce (sqlwork.com)
>
> "Kevin Spencer" <kspencer@.takempis.com> wrote in message
> news:uch70dY0EHA.4028@.TK2MSFTNGP15.phx.gbl...
> | 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.
> |
> | "Dan" <daniel.maier@.zdv.uni-tuebingen.de> wrote in message
> | news:cnvogh$kgj$1@.newsserv.zdv.uni-tuebingen.de...
> | > 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 open a new window as result of a buttonm
> | click.
> | >
> | > thanks for help,
> | > dan
> |
> |
>
Well Kevin I guess there are no other ways for Now!
Patrick
"Kevin Spencer" wrote:

> 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.
> "bruce barker" <nospam_brubar@.safeco.com> wrote in message
> news:efWjMnZ0EHA.3588@.TK2MSFTNGP14.phx.gbl...
> new
>
>
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
Patrick.O.Ige wrote:
> Well Kevin I guess there are no other ways for Now!
> Patrick
> "Kevin Spencer" wrote:
>

0 comments:

Post a Comment