I am opening a window using window.open. I want to disable the close(cross)(X) button which appears on the right hand top corner of the window. I tried window.open(popurl,"","width=1000,height=700,titlebar=0,top=5,left=5,screenX=100,screenY=100"); and window.open(popurl,"","width=1000,height=700,titlebar='NO',top=5,left=5,screenX=100,screenY=100"); but none works as desired. In the specs at w3schools.com I found
=========================================================================== titlebar = yes | no | 1 | 0 whether to display the title bar. Ignored unless the calling application is an HTML Application or a trusted dialog box. Default is yes ===========================================================================
I am calling this from a JSP of the same application. Please help. Thanks in Advance.
You can't. You don't own the user's desktop and shouldn't try to prevent the user from managing his/her own windows. Webapps need to be written with the assumption that the user could leave at any time.
Alright. So is there any particular event which specifically gets called only when the close(cross)(X) button is clicked. The onUnload event gets called on the click of this button but is also called when the form is submitted(rather than a solution this becomes a problem).
You can do one thing. When any user close you window, a new window will open, that will content same thing.
Joined: Apr 25, 2006
Thanks Debashree this works & solves my purpose. But wanted to know the purpose of || w.resizeTo ( 300, 200 ); || here, as its presence or absence or a diff set of arguments is not affecting the output. Pls correct me if I am wrong, I guess it is not working as we have already set the resizable property of window as 'no'. My purpose is solved but would be thankful if someone can tell about the specific event which is called on the click of close(cross)(X) button.
Joined: Jul 27, 2005
It was part of the whole code...u can neglect that. No probs....
Originally posted by Debashree Halder: Check out this piece of code: It resizes the window to full screen. Hence you will not get any cross button
Um, if that works on your computer, you really need to download a service pack. That bug has been fixed for years.
Joined: Nov 08, 2001
You are not going to be able to do it. Why are you doing this in the first place. Use an iframe dynamiclaly poisitioned over the content on the page. No need for a pop up window, no close button issue, etc.
Originally posted by Ben Souther: Most people, upon encountering this irritating behaviour, will immediately dismiss your app as a low grade, poorly written, and possibly dangerous site.
If I had to use that app (maybe because of work), then I'd solve that irritating problem once and for all by applying a liberal dose of GreaseMonkey.
As others have pointed out, there is no way to control anything on a user's computer. HTML code is nothing more than SUGGESTIONS to the user's browser. Knowing this is what seperates the script kiddies from professional web developers.
Joined: Apr 25, 2006
The iframe will not help with that. This really is a job for user training if it is in in house application and session end on the server.
Eric [ August 18, 2006: Message edited by: Eric Pascarello ]
I had a very similar situation. I ended up using XmlHttpRequest to ping the server periodically, so the server could tell my window was still open. When the server stops receiving pings, it knows it can clean up.
If the user presses *our* Close button, the clean up happens straight away. If they press the *browser's* Close button, the clean up has to wait for a time-out. As ours is an intranet Web application, we don't have to make the time-out terribly long. On a true internet Web application, the time-out would have to be quite long, to allow for rubbish connections etc.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
subject: How to disable the close(cross) button of a window