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

Disable the X in the Browser

P: n/a
How do I disable the "X" in the upper right hand corner of my Web Page.
This is not for a windows form, but rather a web application. What I really
need is to stop the user from unloading the page, if certain data is not
present on the page. I know I should not use the Page_Unload event for
this. I wouild like to disable the Close Button, or putting some extra
validation behind a certain event, which event I am not sure. Any help
would be appreciated?


Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Forget about disabling the user to close the browser, it's not going to
happen. But if you tell us why would you want to do that we might be able to
offer you some solutions.

Jerry

"Mike Nooney" <ju***@worldnet.att.net> wrote in message
news:oN**********************@bgtnsc05-news.ops.worldnet.att.net...
How do I disable the "X" in the upper right hand corner of my Web Page.
This is not for a windows form, but rather a web application. What I really need is to stop the user from unloading the page, if certain data is not
present on the page. I know I should not use the Page_Unload event for
this. I wouild like to disable the Close Button, or putting some extra
validation behind a certain event, which event I am not sure. Any help
would be appreciated?

Nov 17 '05 #2

P: n/a
You can't disable the X button without making the page fullscreen, and even
then they can alt+F4 or ctrl+W the page.
You can't keep them from closing the page, but you can warn them with a
client script

<script for=window event=onbeforeunload language=javascript>
if(!YourValidation)
event.returnValue="Your Warning";
</script>

This will pop up a dialog warning them they are navigating away from the
page because of some reason, but you can't keep them from closing a page.
"Mike Nooney" <ju***@worldnet.att.net> wrote in message
news:oN**********************@bgtnsc05-news.ops.worldnet.att.net...
How do I disable the "X" in the upper right hand corner of my Web Page.
This is not for a windows form, but rather a web application. What I really need is to stop the user from unloading the page, if certain data is not
present on the page. I know I should not use the Page_Unload event for
this. I wouild like to disable the Close Button, or putting some extra
validation behind a certain event, which event I am not sure. Any help
would be appreciated?

Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.