Body OnUnload ASP.NET Postback question

  • Thread starter Thread starter Bishop
  • Start date Start date
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?
 
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.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
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


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Back
Top