faqts : Computers : Programming : Languages : JavaScript : Windows

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

274 of 435 people (63%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

Can I disable the window's close (X) button?

May 8th, 2005 09:44
Alexander Stokes, Daniel LaLiberte, Martin Honnen, Jap Boon Churn,


You cannot disbable that button with client side javascript. The user 
remains in control of the window.
Trusted script can however with NN4 open a window without the titlebar.
And IE can open a window fullscreen without titlebar with
  open ('url', 'windowName', 'fullscreen'),but this can be closed with 
ctrl+alt+delete.
Note: Javascript can make the window stay open by using the following 
code on most Javascript aware browsers:
<script language="javascript">
<!--
function reloadthis(){
if(confirm(do you want to stay?)) {   
window.open('your url here', '', 'attributes go here')
}
}     
or if you dont want the confirm box...
<script language="javascript">
<!--
function reloadthis(){
window.open('your url here', '', 'attributes go here')
}
//-->
</script>
Then in replace the body tag with:
<body onUnload="reloadthis();">