Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

close window without prompt 1

Status
Not open for further replies.

spicysudhi

Programmer
Nov 10, 2003
575
FR
hi

how to close the window with no prompt saying u want to close main window...
i hav seen that script somewhere earlier, missed.
regards,
sudhi
 
Cheap & dirty trick:

Code:
function close_win_without_prompt() 
{	window.opener = top;
    window.close();
}
 
i think you mean:

<body onload="opener=self;self.close()">


thanks

co
 
They all work the same way.
Code:
<script>
function close_win_without_prompt() 
{    window.opener = top;
    window.close();
}
</script>
<a href="#" onclick="opener=self;self.close()">close</a>
<a href="#" onclick="opener=self;window.close();">close1</a>
<a href="#" onclick="close_win_without_prompt();">close2</a>
although
Code:
<body onload="opener=self;self.close()">
gives you no choice the window never opens.
There's always more than one way to skin a cat or close a window.

Glen
 
another for absurdity:

Code:
<a href="#" onclick="window.top.window.top.window.top.window.opener = self; window.top.window.top.window.top.window.top.close();">

note that none of these will work in NS/Moz, as this hack is a bug exploit in IE

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
hello,
I'm a french programmer so sorry for the language faults.
function close_win_without_prompt()
{ window.opener = top;
window.close();
}
This code is OK for me and for some of my collegue but for others it doesn't work. I've seen the different versions of IE but they are the same so maybe it exits an option in IE which allows the function window.opener or not.

Please help.

Mag
 

For the record:

I almost got kicked off of experts-exchange for providing a user with this solution. They consider it a "hack" rather than a means of streamlining an application.

They consider it dangerous and malicious code. If they do, it's likely that somewhere, someone else does. So watch where / how you use it.

And stay away from EE. It's a dictatorship.

*cLFlaVA
----------------------------
When will I be able to see what other members can see about myself? It's been like, a freakin' month already!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top