Ending an iSeries Web application session

In addition to using a Web interaction to end a session, you can also invoke a logout action if the user closes the browser. To do this you can write some JavaScript code and modify the <BODY> tag in the JSP file. In the JSP file, add the following statements before the </HEAD> tag:
// Perform logout by invoking the logout action. This will end the iSeries job	
function dologout() {
document.logoutform.action="logout.do";
document.logoutform.submit();
}


// Check if the user has closed the browser. If so, end the job
function checkclose() {
var x = window.event.clientX;
if( x <= -1) {
	alert("You have closed the browser. The application is ending.");
	dologout();
	return true;
}
}
This code assumes that you have a form named logoutform on the page.