   [web] Keeping a Web App open
  I'm developing an internal Web application for a client and the client wants to ensure that the user cannot close out of the Web browser. We are using Internet Explorer 6.0 and ASP.NET 2.0 on Windows 2K3. Since this is an internal application, we have full control over registry and security settings, but the previously mentioned platform is not up for discussion.Currently, I have a window (call it Back) that opens another window (call it Front) in fullscreen mode. If a user hits alt+f4, I throw up a &#106avascript alert box to basically cancel out the close window event (merely returning false from the key event handler does not work). This works... sort of. If the user hits alt+f4 when the alert box is still on the screen, it closes the window. So that's were the Back window comes into play. When it receives focus, it reopens the Front window. However, if the user just spams the alt+f4 combo, they can close the Back window before the script has a chance to open the Front window again.I just want to keep a user from closing the window. My current setup with the Back window is just a kludge to try to mitigate this problem. I'll get rid of it if there is a better solution. Any ideas?   
  AFAIK there's no way to do that. The best you can probably to is set an onclose event and simply pop up a new window when a close is detected. The old window will be closed, but the new window will pop up. The alternative is probably running IE in kiosk mode and have IE take care of it.It sounds to me like you're attacking a problem from a completely wrong angle though. Take a few steps back and please tell us *why* the user shouldn't be able to close the browser. What's the goal here?   ;  Remove the F4 key (and one of ctrl/alt/delete) from the keyboard? Get a custom keyboard with the bare minimum amount of keys required to use the app?AFAIK kiosk mode does not stop the user from pressing alt+f4.I'm not sure, but the pop-up on-exit idea might be able to be defeated by alt+f4 spamming as well - as if you close the page before it manages to load the on-exit script, the script can't run (obviously).Another alternative would be to write your own browser app (not that hard, you can put an IE-control on a form and IE still does all the work) and simply ignore all requests to quit the app.   ;Quote:Original post by SanderIt sounds to me like you're attacking a problem from a completely wrong angle though. Take a few steps back and please tell us *why* the user shouldn't be able to close the browser. What's the goal here?My client is installing touch screen terminals on their production floor (industrial manufacturing). My application runs on the terminal to allow their production employees to enter defect tickets for manufacturing components. The terminal is actually a Cytrix-like thin-client box, loading a Win2K3 image. For some reason, the client wanted this done as a web app; needless to say, it wasn't my idea, I wanted to do it as a WinForms app. I had to be subversive just to avoid having to write the data acess layer as a SOAP web service (would have been way too much overhead for their performance expectations).The client's concern is that bored or cynical employees will fiddle with the terminals and try to figure out how they can shut the application down so that they can claim, "it's broken, I can't enter a ticket, and I can't continue working until I enter this ticket."I've tried Kiosk Mode, it still allows alt+f4. It seems like Kiosk Mode is just for starting IE in fullscreen mode. Hell, it probably doesn't amount to a hill of beans anyway, since I know there is no way disable ctrl+alt+del.   ;Quote:Original post by HodgmanAnother alternative would be to write your own browser app (not that hard, you can put an IE-control on a form and IE still does all the work) and simply ignore all requests to quit the app.this might work   ;  If it's a touch screen, can't you just unhook the keyboard and draw one on-screen (like a tablet PC). This way, you can trap all keys in your app.kind regardsUncle   ;  You probably don't need the additional background window:<body onunload="window.open(document.location);">Anyway, this doesn't stop people from closing the window by franticly pressing Alt-F4.Can you have a web page as desktop background in 2003 like you can in XP and previous versions? You probably would need to remove all desktop icons and minimize the task bar and make sure the user doesn't have the permission to change it back. In this approach, Alt-F4 would display the shut down dialog, but there might be a way around that too.   ;Quote:Original post by WanMasterYou probably don't need the additional background window:<body onunload="window.open(document.location);">Anyway, this doesn't stop people from closing the window by franticly pressing Alt-F4.Can you have a web page as desktop background in 2003 like you can in XP and previous versions? You probably would need to remove all desktop icons and minimize the task bar and make sure the user doesn't have the permission to change it back. In this approach, Alt-F4 would display the shut down dialog, but there might be a way around that too.No, OnUnload is the current page unloading, not the window unloading. So, when the user clicks a link to a new page, this event fires, and you start spawning tons of windows.   ;Quote:Original post by UncleRemusIf it's a touch screen, can't you just unhook the keyboard and draw one on-screen (like a tablet PC). This way, you can trap all keys in your app.kind regardsUncleclient said they didn't want that... half way through having it completed.   ;  You can't stop ctrl-alt-del (well, not easily), but you can disable the problematic icons in it. Use the Windows group policy editor to do that.As for closing the window...I'd suggest that instead of having an explorer window as the watchdog, you have a Windows app. Every millisecond or so, it checks whether the app is still open, and if not, it reopens it. It runs without a window, so there's no way to close it without the task manager (which you've disabled).   