472,348 Members | 1,538 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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 2613
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jonan | last post by:
Hi, I use JavaScript I have tree windows. Jonan1.html has this code erref1=window.open("Jonan2.html", "mypage",null); This opens Jonan2.html and...
6
by: chon | last post by:
I have an ASP page that is sent a file location as a parameter. It opens this file, loads the ADODB.Stream object and does a binary write to the...
6
by: Sujan | last post by:
Hello all, Help me! -------------------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <script...
14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or...
7
by: mg | last post by:
Once opening WebForm2 from WebForm1 using Response.Write("<script language='javascript'>window.open...
4
by: Hitesh | last post by:
Hi, I am opening an Modal dialog box using the window.Showmodaldialogbox(), and in that window i am having an aspx form with say one ASP.NET Button...
2
by: Bert Szoghy | last post by:
Hello, I am missing something about Visual Basic .NET module variables and window close events. In the following code, after opening Form2 by...
37
by: Jan Tovgaard | last post by:
Hey everyone:) We have a critical problem, which I can see that other people also has ran into. In Internet Explorer 7 it is no longer possible...
7
by: Toccoa | last post by:
After considerable googling - I mean searching with Google(r) - I could not find javascript on a button or <a href=... to close a window in the...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

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.