473,386 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 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 2694
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 it has this code...
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 page forcing the download dialog to appear. This...
6
by: Sujan | last post by:
Hello all, Help me! -------------------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <script language="JavaScript"> <!--
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 border. Can I make this happen with a single call to a...
7
by: mg | last post by:
Once opening WebForm2 from WebForm1 using Response.Write("<script language='javascript'>window.open ('WebForm2.aspx','two','menubar=no');</script>"); how can I close WebForm1?
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 control. i am doing some operation on the...
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 clicking a button on Form1 and then closing...
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 to do a window.close after opening a window,...
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 latest versions of IE and FireFox. There seemed...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.