my dog learned polymorphism*
The moose likes HTML, CSS and JavaScript and the fly likes javascript sending a request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "javascript sending a request" Watch "javascript sending a request" New topic
Author

javascript sending a request

Antonio Giovanni
Ranch Hand

Joined: Jun 27, 2005
Posts: 85
Hi all,..

I need some help on this.. i am not a javascript expert

IS there a way that you can send a request to Servlet from javascript??
If so, please let me know. I appreciate your help on this matter.

This is my issue,.. presently working on an intranet application, where users do not log off but close the browser, i do not want to use session time-out and HttpSessionListener to handle removing the session on the server.. because for some reasons we are putting a big value for time-out .. so somehow with a cool javascript i can detect a browser close and ,.. in the javascript when a browser is closed i want to send a request to a servlet which handles the Log Off, .. which in other words .. i want to clear the session on the server even if a user closes the browser, by detecting browser close and then sending a request to servlet..

All the users use IE , so i have no problem to check if this javascript is working fine in all browsers or not...

Thanks again for your help.

PS: this is the link to the javascript for detecting browser close and atleat it is working fine with IE
http://www.jguru.com/faq/view.jsp?EID=1211863
[ October 28, 2005: Message edited by: Bear Bibeault ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
take a look at onbeforeunload.

Eric
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: javascript sending a request