pradeep
pradeep

Reputation: 1057

how to get onunload event on IE

Hi i need to catch an onUnload event but its working in firefox not in IE . Can we capture onUnload event in IE?

Upvotes: 0

Views: 2126

Answers (4)

redsquare
redsquare

Reputation: 78667

<script type="text/javascript">

       function unloadPage(){
           return "dont leave me this way";
       }

       window.onbeforeunload = unloadPage;

</script>

Upvotes: 0

Espo
Espo

Reputation: 41929

There is two events in IE you can use. Click the event-name to see the MSDN details.

Upvotes: 2

tvanfosson
tvanfosson

Reputation: 532495

Could be that an installed plugin is disabling any unload handlers (see this blog post). If that's the case you could remove the plugin or switch to use onbeforeunload.

Upvotes: 1

James
James

Reputation: 82096

You could try the onbeforeunload event.

Upvotes: 0

Related Questions