Forum Moderators: open

Message Too Old, No Replies

Help controlling a window close

controlling window close

         

mikejson

4:01 pm on Mar 9, 2004 (gmt 0)

10+ Year Member



I believe this could be thought of as malicious but let me explain.

I have users logging into a java applet that is creating a telnet session.

The users, because they are on the web, believe they can just close the window.

Is there a way I can "confirm" the window close if they press the X on the window?

I can see how this is somewhat "hi-jacking" the browser but that is not my intention.

If you do not wish others to see the reply, go ahead and stickymail it to me.

Thanks for the help.

mikejson

4:25 pm on Mar 9, 2004 (gmt 0)

10+ Year Member



I found something but it doesn't seem to work in IE6

<body onbeforeUnload="handle()">

gives me "expect an object" error.

maybe I'm using it wrong. I found it in a post here and it says that it only works in IE...(no version stated though).

that would be good enough because this is an internal page, if they aren't using IE6 we say "screw you, conform or don't use your system".... in a nice way anyway :P

Alternative Future

4:28 pm on Mar 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi mikejson,

This script again only works with IE.

<script>
window.onbeforeunload = unloadMess;
function unloadMess(){
mess = ""
return mess;
}
</script>

HTH,

-George

mikejson

11:00 pm on Mar 9, 2004 (gmt 0)

10+ Year Member



Thanks, I did another search on google for the onbeforeload thing and found a script that is exactly what I want which was very similar to what you have.

Thanks alot.
Case closed, works good :)