This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi all, I want to make a class that catch the action of browser that user has opened. So when user of browser clicks close button(x)at the right top of browser, my class can know that action. Can you give me explanation about what kind action which my class have to know? thanks daniel
Closing a browser doesn't generate any sort of event that an HTTP server could use. Since HTTP is stateless, it wouldn't actually make sense to do so anyway - once you've made a request and gotten a response your next request might be to an entirely different server - in fact, most commercial websites have pages with links to other servers anyway - that's how those cheesy ads for X10 spy cameras get popped up - to say nothing of the banner ads. While it's possible that a vendor could produce a browser where a client-side script could be fired to send an HTTP request, it wouldn't work on older versions or other vendors browsers, it wouldn't detect the window closing due to a browser or OS crash, would have a real moral dilemma about what to do if the server's response contained content, and could probably be hacked for nefarious purposes. Bottom line is that HTTP is NOT client/server. You're probably trying to close server sessions, if you're like most people asking that question here, and the mechanisms that work for client/server aren't the mechanisms that work for HTTP.
Customer surveys are for companies who didn't pay proper attention to begin with.
Someone asked that question here a only few days ago!!! Please look at my response and try to get a BASIC understanding of HTTP and how the whole thing works before you start doing JSP/Servlet programming!!! Try and use the search functionality of this forum before asking questions next time. You'll be surprised at how many times your question has been asked/answered. Andre.
I can propose a next solution a your problem: you may include a small applet(or another object) in your page. In handler of onUnload body event you call the method of applet(browser and OS must support LiveConnect).Applet connects with server and you may identify that user closing browser. Applet always has time to connect with server. I think it isn't very good solution, but it's working!
<b><i>KaReEm</i><br /><ul type="square"><li>SCJP-Free Range Web Developer <br /></ul></b>