Google Answers Logo
View Question
 
Q: Javascript: Close All Browser windows ( No Answer,   2 Comments )
Question  
Subject: Javascript: Close All Browser windows
Category: Computers > Programming
Asked by: jameskpolk-ga
List Price: $20.00
Posted: 26 Mar 2003 09:11 PST
Expires: 25 Apr 2003 10:11 PDT
Question ID: 181187
Hi there,
I have an ActiveX control that is residing in an IE browser window.
The ActiveX control has an embedded IE control window where a Web page
is being displayed.

I want the IE control window to be able to close the browser window
containing the activeX control, using Javascript. I have tried many
variations on window.close and can't seem to get it to close the
parent window (it closes itself.)

I've tried:

window.close ("hksinc - ProjectPoint")  <- This is the Title of the
parent page
parent.window.close
opener.close ();
close
window.parent = true
self.close
top.close
window.close ("http://folders.buzzsaw.com/doc/hksinc - Microsoft
Internet

Can you help? Thanks,
Jason

Request for Question Clarification by studboy-ga on 26 Mar 2003 09:48 PST
Hi,

Have you tried:

self.opener.close()

Let me know if this works.  Thanks.

Clarification of Question by jameskpolk-ga on 26 Mar 2003 11:11 PST
I get a script error: "self.opener" is null or not an object.

Jason

Request for Question Clarification by studboy-ga on 26 Mar 2003 14:47 PST
Is this Javascript in the child window or the parent window?  Try:

window.self.opener.close();

Let me know.  Thanks.

Request for Question Clarification by studboy-ga on 26 Mar 2003 14:48 PST
Can you also post the complete HTML?  Thanks.

Clarification of Question by jameskpolk-ga on 26 Mar 2003 16:28 PST
Same error. "window.self.opener is null or is not a valid object."

Here's the code:

<html>
<head>
<script language="JavaScript">	
function window.onload()
<!-- Begin to hide script contents from old browsers.
	{
	//window.close ("hksinc - ProjectPoint")
	//parent.window.close
	//opener.close ();
	//close
	//window.parent = true
	//self.close
	//top.close
	//window.close ("http://folders.buzzsaw.com/doc/hksinc - Microsoft
Internet Explorer")
	window.self.opener.close ()
	}
// End the hiding here. -->
</script>
<title>Disclaimer</title>
</head>

<body>

<p><span style='font-size:13.5pt;font-family:Verdana;
color:red'>By not agreeing to the confidentiality statement as
described, you
are unauthorized to view files located on this site. All activity is
tracked.</span></p>

</body>

</html>

If you want, I can invite you to the location where this page resides
so you can try to make it work. What's your e-mail address?
Jason

Request for Question Clarification by studboy-ga on 26 Mar 2003 16:47 PST
Well, Google Answers forbids me from establishing contact with you off
site...  let me see what I can do.  Thanks

Request for Question Clarification by studboy-ga on 26 Mar 2003 17:02 PST
The problem might be in your calling/parent HTML--

I tried it:

http://www.csua.berkeley.edu/~pchen/t.html

opener.close(), self.opener.close(), window.opener.close()
all worked fine!

Can you check or post the parent code?

Clarification of Question by jameskpolk-ga on 26 Mar 2003 17:11 PST
This is the issue. The parent is an ActiveX control inside another
browser window. The ActiveX is between the browser and this HTML.

Browser
 +- ActiveX Control
     +- IE Control
          +- HTML

We're trying to close 'Browser' from 'HTML' in the diagram below.

Request for Question Clarification by studboy-ga on 26 Mar 2003 18:20 PST
OK, now the issue becomes clear.  The HTML child has no reference to
it's parent (which is in fact the ActiveX control, not the top level
browser.  This reference must be passed somehow.


My hunch is that you have to get the ActiveX control to close its
window right when it spawns the child HTML.  I need a little bit more
digging to see whethe rthis possible.  Can you post your ActiveX code
(C++, C#, or VB)?  Thanks

Clarification of Question by jameskpolk-ga on 28 Mar 2003 07:38 PST
It's not my code. It's part of a system called Buzzsaw - ProjectPoint
is the ActiveX control.

You can set up a trial site and test it out - go to
http://www.autodesk.com/buzzsaw and sign up for a 30-day trial. Then
when you get your site set up, create a folder there, and drag and
drop the HTML page into that folder. Then open it. If you can get it
to work, that's what I'm trying to do.

Thanks,
Jason

PS - the bottom line is we want to have an indemnification screen that
says, "You must agree to these terms to use the site. If you do not,
you can't use this site." Right now our thinking is, if they say no we
close the browser. Something else that could work would be to navigate
them away from the site - to another URL, say www.hksinc.com or
www.autodesk.com.

Thanks!

Clarification of Question by jameskpolk-ga on 28 Mar 2003 12:10 PST
Did you get that? (below)

Instead of the closing, can we cause the parent to navigate somewhere else?

Request for Question Clarification by studboy-ga on 31 Mar 2003 10:48 PST
Hi James

You still need the parent's code.  Back to the house analogy: you
wouldn't do everything the child tells you to do, would you?  Unless
you give the go/permission :)

How about emailing Autodesk and ask them for the code?  Tell them
you'r ebuying their software.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Javascript: Close All Browser windows
From: darknessproductions-ga on 27 Mar 2003 10:40 PST
 
I've found on many javascript sites that it's not possible for a child
window to close a parent window directly.  You *can*, however, have
the parent close itself, but the user will get a dialog box asking if
they want to close the window.

Not the prettiest way to do it, but I believe it's the only way.
Subject: Re: Javascript: Close All Browser windows
From: jameskpolk-ga on 28 Mar 2003 10:54 PST
 
What about having a child tell a parent to go somewhere else?

It happens all the time in my house... :)

Seriously - can the child window control the location of the parent??

Jason

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy