We managed to do it, but by tricking the calling window.  Here's a code
snippet that might be useful for some of you out there:

mainwin = window.open('#NewURL#', 'mainwin', '');
<!--- Close original window, this trick works under IE5.5+ only --->
mainwin.opener = mainwin;
window.opener = mainwin;
window.close();

(to be fair, I have to give credit for this to another of our developers...)

Shawn Grover


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 27, 2002 12:28 PM
To: CF-Talk
Subject: RE: Closing a window from JS without prompt?


that snippet didn't work in either NS or IE for me....

IE didn't even load the page and NS bombed because it said that closes
was
not defined

i just pasted that snippet into a page.

is there something else that needs to be done?




"Justin Waldrip" <[EMAIL PROTECTED]> on 02/27/2002 01:17:54 PM

Please respond to [EMAIL PROTECTED]

To:   CF-Talk <[EMAIL PROTECTED]>
cc:

Subject:  RE: Closing a window from JS without prompt?


I have an app that opens up a window full screen and then I need to
close the parent window that is behind it. So what I did was added th
e
object code below to the head and then refresh the parent window with
the onload function that initiates and closes the parent window. Work
s
like a champ for me. You might have to play around with it depending
on
your need.

<html>
<head>
     <title>Untitled</title>
     <!--- // Must have this in the head // --->
     <object id="closes" type="application/x-oleobject
classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
          <param name="Command" value="Close">
     </object>
</head>

<script>
function closeme() {
     closes.Click();
}
</script>


<body onload="document.form.CloseArea.focus();">

<form>
     <input type="text" name="CloseArea" onfocus="closeme()"
style="width: 0px;">
</form>

</body>
</html>

-----Original Message-----
From: Shawn Grover [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 27, 2002 1:04 PM
To: CF-Talk
Subject: OT: Closing a window from JS without prompt?

I'm looking for ideas on how to close a Parent window from Javascript
without getting the confirmation prompt.
We don't have an issue with any child windows, but we open an interface

to
our app then want to close the original window without the prompt.

Any tips?  Thanks in advance.

Shawn Grover



______________________________________________________________________
Why Share?
  Dedicated Win 2000 Server · PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to