Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Closing Parent Frame Window

Posted on 2003-03-21
7
Medium Priority
?
2,017 Views
Last Modified: 2012-06-27
Hi,

I have created an ASP page containing 3 frames, say left,middle & right . User is entering some data in middle frames and to save pressing save button and i m redirecting user to the next page. If the details are saved i m giving successful message to user using window.alert.

Now I want to close the main browser(frame) window as soon as the user presses OK button. Pls help me..

regards,
Pankaj Bhatnagar
0
Comment
Question by:bhatnagarp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 6

Expert Comment

by:CyberGhost
ID: 8179745
As far as I know there is no way to close parent window without showing a prompt with question if really close MSIE window to user. If you open a child window, it can be closed without this prompt.

For close opened window you can use:

<script language="JavaScript">
<!--
test=window.open('test.html');
//-->
</script>

<input type=button value="CLOSE" onClick="test.close()">

regards
0
 
LVL 1

Expert Comment

by:niteshn
ID: 8179824
window.close(), self.close() functions can be used to close the windows. But if the window being closed is an instance opened by the user, he will be prompted whether he actually wants to close the window or not. The basic funda is that you may close those windows thru javascript opened by you (using javascript)
0
 
LVL 4

Accepted Solution

by:
Sashi Rachabattula earned 750 total points
ID: 8179866
here u r call this function

<script>
function closetop()
{
top.window.close()
}
</script>
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 6

Expert Comment

by:CyberGhost
ID: 8179905
But that will always bring that prompt as I said.

This is from http://developer.netscape.com/docs/manuals/communicator/jsref/index.htm ...



close
Closes the specified window.
Method of
 Window
 
Implemented in
 Navigator 2.0: closes any window.
Navigator 3.0: closes only windows opened by JavaScript.
Navigator 4.0: must use signed scripts to unconditionally close a window.
 



Syntax
close()
Parameters
None

Security
Navigator 4.0: To unconditionally close a window, you need the UniversalBrowserWrite privilege. For information on security in Navigator 4.0, see Chapter 7, "JavaScript Security," in the JavaScript Guide.

Description
The close method closes the specified window. If you call close without specifying a windowReference, JavaScript closes the current window.
The close method closes only windows opened by JavaScript using the open method. If you attempt to close any other window, a confirm is generated, which lets the user choose whether the window closes. This is a security feature to prevent "mail bombs" containing self.close(). However, if the window has only one document (the current one) in its session history, the close is allowed without any confirm. This is a special case for one-off windows that need to open other windows and then dispose of themselves.

In event handlers, you must specify window.close() instead of simply using close(). Due to the scoping of static objects in JavaScript, a call to close() without specifying an object name is equivalent to document.close().


Examples
Example 1. Any of the following examples closes the current window:

window.close()self.close()close()
Example 2: Close the main browser window. The following code closes the main browser window.

top.opener.close()
Example 3. The following example closes the messageWin window:

messageWin.close()
This example assumes that the window was opened in a manner similar to the following:

messageWin=window.open("")
0
 

Expert Comment

by:sbdidine
ID: 8180049
you can try parent.close()
I know it works for parent.location.assign("newPage.html") so maybe...
0
 
LVL 6

Expert Comment

by:CyberGhost
ID: 8180111
I've tried that. It does raise the prompt. Think there is no way to "hack" it.

regards
0
 
LVL 6

Expert Comment

by:CyberGhost
ID: 8180127
I've tried that. It does raise the prompt. Think there is no way to "hack" it.

... by the way that parent.location.assign("newPage.html") has done endless loop with that prompt so maybe that could be a way to provoke into closing it. Or to not visit that site again ;o)

regards
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question