Click to See Complete Forum and Search --> : Close a Window
garyhay
02-27-2003, 01:57 PM
Okay I have searched the forum (this and forty others) and still cannot make this work.
I have tried many different scripts but none seem to work.
Here is my problem. As with another thread I have seen I want to launch an HTML file from a CD-ROM. I need this window to open centred with toolbars off etc and have managed this part only by calling this window from another window. This lets me control size toolbars etc.
I am having real problems closing the calling window.
I am also not sure how to call two scripts in the <Body tag.
Thanks to everyone who can help
ShrineDesigns
02-27-2003, 02:21 PM
you must get permission from the user to close that window
to call two or more scripts:
Example:
<body onLoad="funcOne(); funcTwo(); etc()">
Originally posted by garyhay
I am having real problems closing the calling window.window.opener.close();
garyhay
02-27-2003, 02:32 PM
window.opener.close();
Sorry I an not sure where this goes.
In the Head or Body section and of which window. The pop up or the opener.
Thanks again
Put it in the <head> section of you popup.
ShrineDesigns-
You might be interested in this: http://www.infinitypages.com/research/selfclose.htm
garyhay
02-27-2003, 03:23 PM
Thanks
nearly there now.
What I now need (I assume it's possible) is to integrate the self.close example so it happens automatically.
I would realy appreciate it if you can get me over this final hurdle.
I have been at this for too many hours now my head has just stopped thinking straight. -_-_-_--_--___
Is this what you need?
<script language="javascript" type="text/javascript">
function closewin()
{
self.close();
}
</script>
<body onLoad="opener=self;closewin();">
Charles
02-27-2003, 03:28 PM
This is one of those questions that keeps geting asked. And you cannot do what it is that you want to do, not with JavaScript. But you might find this link of some use: http://tech.irt.org/articles/js191/.
What are you talking about, Charles? I think you _can_ do what he is looking to do with javascript... :confused:
A couple more things...
Just because you can do this, doesn't mean you should. I personally wouldn't be to happy if the sites I went to were closeing my windows on me, especially a parent window. Also, you will want to remember to open your new window _before_ the self.close(); otherwise, all it will do when they go to your site is close the browser window. :p
garyhay
02-27-2003, 03:56 PM
That never worked
I do think that Javascript just can't do this as I have tried everything.
I have posted my pages here http://www.e-commerce-aberdeen.com/js/2.htm
Thanks again
garyhay
02-27-2003, 03:58 PM
I would never do this on a web site. It's for a CD-ROM as my thread starting message explained.
I will open the first window so I can set the size of the second window and remove toolbars from it etc.
Originally posted by garyhay
I do think that Javascript just can't do this as I have tried everything.The link you posted worked for me in IE6...
garyhay
02-27-2003, 04:49 PM
Hey that is wierd
It does work where it was posted just not the local disk??
It still gives the "The Window you are viewing.... " message.
Maybe it only works if the self window is called from another web page. I will test it out
This is working from my desktop...
garyhay
02-27-2003, 05:06 PM
Thanks very much for your help. I am afraid my lack of understanding of the javascript syntax was to blame.
Too many " splitting the java functions in the OnLoad=
Cheers.:D