469,578 Members | 1,298 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,578 developers. It's quick & easy.

Close opening window without using OK button

mg
I need to first open WebForm2 from WebForm1 and then
close WebForm1 without the end user having to press an OK
button before the close can occur.

For example, possibly

Response.Write("<script language='javascript'>window.open
('WebForm2.aspx','two','menubar=no');</script>")

Is there code that will accomplish this without using 3rd-
party software?
Nov 18 '05 #1
7 2526
You can window.close any window that you spawn yourself without a warning,
but you can't close the main window (that the user launched) without the
user's consent. If your current strategy is to have web form 1 open a new
window and then close itself, why is this functionally different than the
result of a window.navigate? You still end up with a single browser window
open, and no dialog. I'm confused as to why you need to open a new window at
all...?

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"mg" <mg@theworld.com> wrote in message
news:08****************************@phx.gbl...
I need to first open WebForm2 from WebForm1 and then
close WebForm1 without the end user having to press an OK
button before the close can occur.

For example, possibly

Response.Write("<script language='javascript'>window.open
('WebForm2.aspx','two','menubar=no');</script>")

Is there code that will accomplish this without using 3rd-
party software?

Nov 18 '05 #2
Still javascript. For example, as the onclick event of a button that
opens webform(2) and closes the opener webform(1):

Response.Write("<script
language=javascript>window.opener.location='webfor m2.aspx';self.close();
</script>")

HTH,

Kathy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3
mg
This doesn't seem to work. Are you sure about this code as
a way for one page to open another and then close itself
without the end user having to press the OK button?
-----Original Message-----
Still javascript. For example, as the onclick event of a button thatopens webform(2) and closes the opener webform(1):

Response.Write("<script
language=javascript>window.opener.location='webfo rm2.aspx' ;self.close();</script>")

HTH,

Kathy

*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!
.

Nov 18 '05 #4
mg

I need to use arguments like 'menubar=no' that window.open
() provide; so, simple navigation won't do.
-----Original Message-----
You can window.close any window that you spawn yourself without a warning,but you can't close the main window (that the user launched) without theuser's consent. If your current strategy is to have web form 1 open a newwindow and then close itself, why is this functionally different than theresult of a window.navigate? You still end up with a single browser windowopen, and no dialog. I'm confused as to why you need to open a new window atall...?

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"mg" <mg@theworld.com> wrote in message
news:08****************************@phx.gbl...
I need to first open WebForm2 from WebForm1 and then
close WebForm1 without the end user having to press an OK button before the close can occur.

For example, possibly

Response.Write("<script language='javascript'>window.open ('WebForm2.aspx','two','menubar=no');</script>")

Is there code that will accomplish this without using 3rd- party software?

.

Nov 18 '05 #5
OK. Try this:

<html>
<script type="text/JavaScript">
function closeMe() {
window.opener = self;
window.close();
}
</script>
<body>
<input type="button" onclick="closeMe()" value="Close" />
</body>
</html>

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"mg" <mg@theworld.com> wrote in message
news:00****************************@phx.gbl...

I need to use arguments like 'menubar=no' that window.open
() provide; so, simple navigation won't do.
-----Original Message-----
You can window.close any window that you spawn yourself

without a warning,
but you can't close the main window (that the user

launched) without the
user's consent. If your current strategy is to have web

form 1 open a new
window and then close itself, why is this functionally

different than the
result of a window.navigate? You still end up with a

single browser window
open, and no dialog. I'm confused as to why you need to

open a new window at
all...?

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"mg" <mg@theworld.com> wrote in message
news:08****************************@phx.gbl...
I need to first open WebForm2 from WebForm1 and then
close WebForm1 without the end user having to press an OK button before the close can occur.

For example, possibly

Response.Write("<script language='javascript'>window.open ('WebForm2.aspx','two','menubar=no');</script>")

Is there code that will accomplish this without using 3rd- party software?

.

Nov 18 '05 #6
Chris is right of course. I use this for when I've opened a pop-up
window, then when the user completes the form and opens another, the
close.self closes the pop-up.

Sorry if I confused things.

Kathy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #7
mg
By George, that did it!

Thank you.

-----Original Message-----
OK. Try this:

<html>
<script type="text/JavaScript">
function closeMe() {
window.opener = self;
window.close();
}
</script>
<body>
<input type="button" onclick="closeMe()" value="Close" /> </body>
</html>

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"mg" <mg@theworld.com> wrote in message
news:00****************************@phx.gbl...

I need to use arguments like 'menubar=no' that window.open () provide; so, simple navigation won't do.
>-----Original Message-----
>You can window.close any window that you spawn yourself

without a warning,
>but you can't close the main window (that the user

launched) without the
>user's consent. If your current strategy is to have web

form 1 open a new
>window and then close itself, why is this functionally

different than the
>result of a window.navigate? You still end up with a

single browser window
>open, and no dialog. I'm confused as to why you need to

open a new window at
>all...?
>
>--
>Chris Jackson
>Software Engineer
>Microsoft MVP - Windows Client
>Windows XP Associate Expert
>--
>More people read the newsgroups than read my email.
>Reply to the newsgroup for a faster response.
>(Control-G using Outlook Express)
>--
>
>"mg" <mg@theworld.com> wrote in message
>news:08****************************@phx.gbl...
>> I need to first open WebForm2 from WebForm1 and then
>> close WebForm1 without the end user having to press
an OK
>> button before the close can occur.
>>
>> For example, possibly
>>
>> Response.Write("<script

language='javascript'>window.open
>> ('WebForm2.aspx','two','menubar=no');</script>")
>>
>> Is there code that will accomplish this without using

3rd-
>> party software?
>
>
>.
>

.

Nov 18 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by D. Alvarado | last post: by
7 posts views Thread by mg | last post: by
4 posts views Thread by Hitesh | last post: by
37 posts views Thread by Jan Tovgaard | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.