Meaningless Drivel is fun!*
The moose likes HTML, CSS and JavaScript and the fly likes how to exit from a page 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 "how to exit from a page" Watch "how to exit from a page" New topic
Author

how to exit from a page

gaurav chhabra
Ranch Hand

Joined: Jul 24, 2004
Posts: 109
sir
i have a button in my project and i want that if someone clicks that button then it closes the project..........
i m writting....

<html>

<head>
<title>JAI SHRI RAM</title>
</head>

<body>
<%
System.exit(0);
%>
</body>

</html>

the above code not make me close the whole project
plz suggest me the solution
Rohit Bhagwat
Ranch Hand

Joined: Dec 19, 2004
Posts: 205
What do you mean by close whole project ?
Do you mean to say close browser window ?
Using System.exit(0) will shutdown the container..

Regards
Rohit.
gaurav chhabra
Ranch Hand

Joined: Jul 24, 2004
Posts: 109
thanks for reply
ya sir i mean to close the browser window by clicking the button
thank you
garav
Rohit Bhagwat
Ranch Hand

Joined: Dec 19, 2004
Posts: 205
First of all I am not a sir ok !!

Coming back.

Now since you said you want to close the browser window which is ofcourse of the client so that means you have to do coding that will execute at client side to close client's browser.

So use javascript that executes at client side.

<script language="javascript">
function closeWindow()
{
window.close();
}
</script>

now call this method closeWindow() in the onclick event of your button.

I guess this will prompt you to ensure that whether you want to close this window and then on clicking yes your window will be closed.

I hope I am close to your solution.
I have never tried this. But hope it works.

Regards
Rohit
gaurav chhabra
Ranch Hand

Joined: Jul 24, 2004
Posts: 109
thank you very very much for ur suggestion
it works out
bye
gaurav
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to exit from a page