By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,516 Members | 1,135 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,516 IT Pros & Developers. It's quick & easy.

Disabling the close button

P: n/a
All,

How can I disable or remove the close button in the screen.

thanks

Nov 29 '05 #1
Share this Question
Share on Google+
13 Replies


P: n/a
"lightzizo" <m.*********@gmail.com> skrev i meddelandet
news:11**********************@g43g2000cwa.googlegr oups.com...
All,

How can I disable or remove the close button in the screen.

thanks


You've been asking this question in various guises several times. The answer
is still "you can't".

If you think your application requires this functionality, you have
misunderstood the environment that your application has to work with. You
will therefore either have to redesign your application to work within those
limitations, or choose a different environment that lets you do what you
want (such as creating an application that's not browser-based).

(Even if you could remove the close button, how would your application deal
with, say, a forced-quit of the browser?)

--
Joakim Braun
Nov 29 '05 #2

P: n/a
lightzizo wrote:
How can I disable or remove the close button in the screen.


Neither can you nor should you (attempt to).

Name the reasons why you think this is necessary, and you
will probably receive numerous replies why it is not.
PointedEars
Nov 29 '05 #3

P: n/a
You may use javascript function attachEvent:

function window.onload()
{
window.attachEvent("onbeforeunload", Close);
}

function Close()
{
return 'Are you sure you want to close my lovely window?'
}
If you think the anwser helps you, please show your support by visiting
my website:

http://www.logicwebsolutions.com

Nov 29 '05 #4

P: n/a
"James" <ja*******@yahoo.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
You may use javascript function attachEvent:

function window.onload()
{
window.attachEvent("onbeforeunload", Close);
}

function Close()
{
return 'Are you sure you want to close my lovely window?'
}
If you think the anwser helps you, please show your support by visiting
my website:

http://www.logicwebsolutions.com


Perhaps just the following?

<html>
<head>
<title>closer.htm</title>
<script type="text/javascript">
function closer() {
alert("This window is about to close.");
}
</script>
</head>
<body onbeforeunload="closer()">
</body>
</html>
Nov 29 '05 #5

P: n/a
If you do not have other functions to handle this event you approch is
fine.

BTW, you shoud use return instead of alert; by using return, the page
will stay
if the user clicks Cancel button from the popup window.

James
http://www.logicwebsolutions.com

Nov 29 '05 #6

P: n/a

lightzizo wrote:
All,

How can I disable or remove the close button in the screen.

thanks


Since others could not convince you, here's a solution you can attempt:

1. Learn a programming language
2. Create your own web browser application
3. Create a method in which you can remove / disable the close button
via script.

Simple, huh?

Nov 29 '05 #7

P: n/a
James wrote:
You may use javascript function attachEvent:
attachEvent is neither a JavaScript nor a JScript function.
It is a method of the IE(4?) DOM.

<URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/attachevent.asp>
function window.onload() -----------------^
SyntaxError: missing ( before formal parameters
If you think the anwser helps you, please show your support by visiting
my website:


YMMD!
PointedEars
Nov 29 '05 #8

P: n/a
McKirahan wrote:
"James" <ja*******@yahoo.com> wrote [...]:
You may use javascript function attachEvent:

function window.onload()
{
window.attachEvent("onbeforeunload", Close);
}

function Close()
{
return 'Are you sure you want to close my lovely window?'
}

[...]


Perhaps just the following?

<html>
<head>
<title>closer.htm</title>
<script type="text/javascript">
function closer() {
alert("This window is about to close.");
}
</script>
</head>
<body onbeforeunload="closer()">
</body>
</html>


In contrast to your solution, James', even though it has its bugs, allows
the user to cancel the unload-Event in IE an Mozilla/5.0 if corrected (and
it does not make a successful attempt in providing invalid HTML). However,
I am not sure whether selecting "Cancel" would also prevent closing the
window.
PointedEars
Nov 29 '05 #9

P: n/a
James said the following on 11/29/2005 1:25 PM:

Please quote what you are replying to.

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.

You may use javascript function attachEvent:

function window.onload()
{
window.attachEvent("onbeforeunload", Close);
}

function Close()
{
return 'Are you sure you want to close my lovely window?'
}
That does absolutely nothing to stop me from closing the browser. In
fact, it only makes me *more* determined to leave your site. I am
leaving, let me go in Peace.
If you think the anwser helps you, please show your support by visiting
my website:


I hope your website has better advice than you give here.

For example, does it explain that in Usenet you should quote what you
are replying to?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 29 '05 #10

P: n/a
Hello all
thanks for your replies

but actually I want to describe the situation here:
I'm opening a popup window from another popup and i don't want the user
to close the parent popup as long as the child is still opened.
I've thought about making the child to be modal screen but how can i do
that??


Randy Webb wrote:
James said the following on 11/29/2005 1:25 PM:

Please quote what you are replying to.

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.

You may use javascript function attachEvent:

function window.onload()
{
window.attachEvent("onbeforeunload", Close);
}

function Close()
{
return 'Are you sure you want to close my lovely window?'
}


That does absolutely nothing to stop me from closing the browser. In
fact, it only makes me *more* determined to leave your site. I am
leaving, let me go in Peace.
If you think the anwser helps you, please show your support by visiting
my website:


I hope your website has better advice than you give here.

For example, does it explain that in Usenet you should quote what you
are replying to?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Nov 30 '05 #11

P: n/a
lightzizo wrote:
I'm opening a popup window from another popup and i don't want the
user to close the parent popup as long as the child is still opened.
I've thought about making the child to be modal screen but how can
i do that??
You do not, that would only make your app less interoperable (IE only).
Returning a string to onbeforeunload is probably the best approach
here. Let the user decide whether or not the window should be closed.
[top post]


<URL:http://jibbering.com/faq/faq_notes/pots1.html#ps1Post>
PointedEars
Nov 30 '05 #12

P: n/a
Use JavaScript function:

window.showModalDialog

Nov 30 '05 #13

P: n/a
James wrote:
Use JavaScript function:

window.showModalDialog


which is not a JavaScript function and is IE-only, so don't.
PointedEars
Nov 30 '05 #14

This discussion thread is closed

Replies have been disabled for this discussion.