Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Body OnUnload ASP.NET Postback question

Reply
Thread Tools

Body OnUnload ASP.NET Postback question

 
 
Bishop
Guest
Posts: n/a
 
      07-17-2009
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?

 
Reply With Quote
 
 
 
 
Gregory A. Beamer
Guest
Posts: n/a
 
      07-17-2009
"Bishop" <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> 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/HT...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 **** 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! |
*******************************************
 
Reply With Quote
 
 
 
 
Gregory A. Beamer
Guest
Posts: n/a
 
      07-20-2009
"Mark Rae [MVP]" <(E-Mail Removed)> wrote in
news:u4xKD$(E-Mail Removed):


> 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! |
*******************************************
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to programmatically add onLoad and onUnload handlers to BODY tag in ASP.NET 2.0 ~~~ .NET Ed ~~~ ASP .Net 5 03-27-2007 02:26 PM
Adding "onunload" JavaScript event handler to body in code-behind Laurent Bugnion ASP .Net 1 01-21-2006 09:53 PM
Trapping the <BODY> onUnload() / Detecting when a user closes the browser =B= ASP .Net 3 09-30-2004 08:20 AM
add <body onunload="blah();"> Oleg Ogurok ASP .Net 2 12-29-2003 10:16 PM
onunload without body tag reference? Brian Vallelunga Javascript 2 07-28-2003 06:37 PM



Advertisments