Monday, November 16, 2009

How to detect browser close button is clicked ?

call this function from page_unload() so when user will close the browser either by [X] button or by alt+f4 or from exit (from file menu). by using this function you can detect that browser is going to close and you can perform any of your choice operation just before browser get close.

function CheckBrowser()
{
// Check Browser Close [X] , Alt+F4 , File -> Close
if(window.event.clientX < 0 && window.event.clientY <0)
{
window.open("Operation.aspx",
"Operation",'left=12000,top=1200,width=10,height=1');
}
}

Share This!


6 comments:

Anonymous said...

Nice brief and this enter helped me alot in my college assignement. Thanks you on your information.

Anonymous said...

USA

Anonymous said...

hello


Just saying hello while I read through the posts


hopefully this is just what im looking for looks like i have a lot to read.

Anonymous said...

Generally I do not post on blogs, but I would love to mention that this post extremely forced me to try and do therefore! really nice post. thanks, here's a similar subject you'll like [url=http://blogtext.org/corina33/article/221532.html]Old Clocks[/url]

Anonymous said...

very nice post - simple but very informative

buy backlinks

Anonymous said...

Nice one, thanks for the tip

Powered By Blogger · Designed By Seo Blogger Templates