Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asptoday_discuss thread: unload function in javascript.


Message #1 by Subha Gowri <subha@i...> on Thu, 21 Feb 2002 15:25:50 +0530
Hi all,



Anyone knows how to control the browser close button?

(i.e) on close of browser i want to execute javascript code.



I tried the following :



<html>

<head>

<SCRIPT FOR=window EVENT=onunload>

    alert("Hello");

</SCRIPT>

</head>

<body>

<a ref="next.htm">Next page</a>

</body>

</html>



but it is executing javascript code

1. while navigating to the next page through the link

2. While refreshing the page by pressing the browser's refresh button.



Any idea how to solve the above?



Thnaks,

Subha







Message #2 by Senthil Raja V <senthil@s...> on Mon, 25 Feb 2002 11:42:10 +0530
Hi



try this.

onbeforeunload() firing before any onunload events. supported only in IE.



Regards

Senthil.



At 03:25 PM 21/02/2002 +0530, you wrote:

>Hi all,

>

>Anyone knows how to control the browser close button?

>(i.e) on close of browser i want to execute javascript code.

>

>I tried the following :

>

>Next page

>but it is executing javascript code

>1. while navigating to the next page through the link

>2. While refreshing the page by pressing the browser's refresh button.

>

>Any idea how to solve the above?

>

>Thnaks,

>Subha

>

>






  Return to Index