Body OnUnload ASP.NET Postback question

B

Bishop

I want to display an exit web page when someone closes a web page from they're
browser. Looks like I can do this with JavaScript and the Body OnUnload tag
but it kicks off with a post back. Any tricks to preventing this from
kicking off on post back and only when closing the browser?
 
G

Gregory A. Beamer

I want to display an exit web page when someone closes a web page from
they're browser. Looks like I can do this with JavaScript and the
Body OnUnload tag but it kicks off with a post back. Any tricks to
preventing this from kicking off on post back and only when closing
the browser?


You can check whether or not a user is closing the browser down:
http://www.coderanch.com/t/112054/HTML-JavaScript/check-if-browser-close-
button

You can also check if a user is leaving your site, hitting the back button,
etc. I don't have links for these.

You then code these checks and only if they are true do you show the exit
page.

NOTE: If this is not an Intranet, you are going to piss a lot of people off
if you stop the browser from shutting down until they read your page.
 
G

Gregory A. Beamer

That's the salient point here. In my experience, people will never
return to a site which does this to them...

Preacher >> Choir LOL

I am waiting for the "I want to make dozens of pop ups when someone tries
to leave my site conversation. ;-0
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top