How to show alert message while closing the page in ?


In our project so many time we will get a senario to give confirmation alert message whenever somebody click on close icon of page specially in long registration page.

We can do this task using few line of javascript like this.

<script language="JavaScript" type="text/javascript">
window.onbeforeunload = Unload_Call;

function Unload_Call() {
var Message = "Are you sure,do you want to leave this page?";
return Message;


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.