This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

need to differentiate between the window closing an window refreshing

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a situation where I need to stop a window from closing and display a confirmation box before I allow the entire application to close by using either a self.close() link or the x in the browser. The problem is I cant have this popup when the page is just being refreshed by the user.
right now to do this I am using:
var strMsg = "This action will close the entire application.";
window.event.returnValue=strMsg;
in the onbeforeunload event.
Any help would be great!!!
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the event you mentioned (onbefore...) only works in IE.
There is no way to detect when the browser is refreshed or closed.
Eric
 
Pablo Ducati
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is for an intranet, so it is an IE only gig. Let me explain my situation and maybe a better solution will present itself. I have an application that will launch with a main window and anywhere from 0 to n child windows will also be loaded. This application is for non-web savvy people, so the first thing that is needed is a confirmation box to ask if a person really wants the main page to close. The second thing is, if yes log the person out, close all child windows, and then close the main window. Else if no, then leave everything open and the user logged in.
Hopefully this will spawn some ideas. Thanks
 
A feeble attempt to tell you about our stuff that makes us money
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!