Türkçe   |   English
Calendar
Categories
Archive
Links
Blogroll
Files

Catching Internet Explorer tab closing - 20.12.2008

When we want to do something with javascript when a user closes an Explorer window, we simply handle the body onunload event. But when a user is working in an explorer that has more than one tab open, this event doesn't work when we want to do something if the user closes a tab, not the explorer window. So, if we need to do something when a user closes an explorer tab and since a browser tab is a window, we can simply handle the window.onbeforeunload event:

<script language="javascript" type="text/javascript">
window.onbeforeunload = opengoodbyepage;
function opengoodbyepage()
{
window.open(
'bye.aspx', 'popUpWin',
"toolbar=no,location=no,menubar=no,resizable=no,width=410,height=300,top=300,left=400");
}
</script>

Code

22.05.2009 - abs
asdasd
Add Comment
First Name Last Name
Web Site
E-Mail
Comment
Security Picture

Photos
Me in MSDN Forums
-   Answered the question How can i get it in the Visual C# General forum
-   Answered the question How to add the VAT to the ammount in the Visual Basic General forum
-   Contributed a proposed answer to the question How to add the VAT to the ammount in the Visual Basic General forum
-   Replied to the question How can i get it in the Visual C# General forum
-   Replied to the question How to add the VAT to the ammount in the Visual Basic General forum
-   Answered the question How to show ToolStripMenuItem's hot key? in the Windows Forms General forum
-   Contributed a proposed answer to the question How to show ToolStripMenuItem's hot key? in the Windows Forms General forum
-   Answered the question Expert to Excel Missing Some Data In Grid View in the Visual C# Language forum
-   Contributed a helpful post (total votes:1) to the forums thread Expert to Excel Missing Some Data In Grid View in the Visual C# Language forum
-   Replied to the question How to show ToolStripMenuItem's hot key? in the Windows Forms General forum
Entries
News
Articles