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!


8 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...

Nice one, thanks for the tip

Anonymous said...

That is a very good tip particularly to those new to the
blogosphere. Short but very precise info? Thanks for sharing this one.
A must read post!

Anonymous said...

Hello, constantly i used to check website posts here early in the dawn, as i
love to learn more and more.

Anonymous said...

Hi there, I enjoy reading all of your article. I wanted to write a little comment to support you.

Powered By Blogger · Designed By Seo Blogger Templates