PC Review


Reply
Thread Tools Rate Thread

Detecting user leaving page

 
 
daveh551
Guest
Posts: n/a
 
      5th Aug 2008
Okay, I feel like this is probably a stupid question, but...

I have accessed sites that are pushing some scam that, when you go to
leave the page it will pop up a box saying, "No, don't go, let our
live agent talk you into buying our junk."

My question is, what event do they use to tell that you are leaving
the page? Looking through the events available in the Page class, I
see a lot that take place when the page is initiated, but nothing that
is triggered when the user leaves.

What am I missing?

Thanks for your help.
 
Reply With Quote
 
 
 
 
Juan T. Llibre
Guest
Posts: n/a
 
      5th Aug 2008
They use a standard html event : Body_OnUnload.

http://www.htmlcodetutorial.com/docu..._onUnload.html



Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaņol : http://asp.net.do/foros/
======================================
"daveh551" <(E-Mail Removed)> wrote in message news:204a3f91-4c42-48a3-b53c-(E-Mail Removed)...
> Okay, I feel like this is probably a stupid question, but...
>
> I have accessed sites that are pushing some scam that, when you go to
> leave the page it will pop up a box saying, "No, don't go, let our
> live agent talk you into buying our junk."
>
> My question is, what event do they use to tell that you are leaving
> the page? Looking through the events available in the Page class, I
> see a lot that take place when the page is initiated, but nothing that
> is triggered when the user leaves.
>
> What am I missing?
>
> Thanks for your help.



 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      5th Aug 2008
It's a client side event, not a server side (ASP .NET) event. It's simply
the unload event.


"daveh551" <(E-Mail Removed)> wrote in message
news:204a3f91-4c42-48a3-b53c-(E-Mail Removed)...
> Okay, I feel like this is probably a stupid question, but...
>
> I have accessed sites that are pushing some scam that, when you go to
> leave the page it will pop up a box saying, "No, don't go, let our
> live agent talk you into buying our junk."
>
> My question is, what event do they use to tell that you are leaving
> the page? Looking through the events available in the Page class, I
> see a lot that take place when the page is initiated, but nothing that
> is triggered when the user leaves.
>
> What am I missing?
>
> Thanks for your help.



 
Reply With Quote
 
daveh551
Guest
Posts: n/a
 
      6th Aug 2008
On Aug 4, 10:13 pm, "Scott M." <s-...@nospam.nospam> wrote:
> It's a client side event, not a server side (ASP .NET) event. It's simply
> the unload event.
>
> "daveh551" <gee...@gmail.com> wrote in message
>
> news:204a3f91-4c42-48a3-b53c-(E-Mail Removed)...
>
> > Okay, I feel like this is probably a stupid question, but...

>
> > I have accessed sites that are pushing some scam that, when you go to
> > leave the page it will pop up a box saying, "No, don't go, let our
> > live agent talk you into buying our junk."

>
> > My question is, what event do they use to tell that you are leaving
> > the page? Looking through the events available in the Page class, I
> > see a lot that take place when the page is initiated, but nothing that
> > is triggered when the user leaves.

>
> > What am I missing?

>
> > Thanks for your help.


Thanks, both of you. That makes sense.

Follow on question, and dont feel compelled to answer it because Im
sure I can dig a little and find the answer on my own, but what kind
of javascript code would I write to reflect that event back to the
server to do something with there?(I.e, I want to record the time the
user spent on a page in a database for statistical analysis, so I need
to record when they leave.)
 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      6th Aug 2008
You could place an HTML hidden form field into the page and then update that
field's value with the current time on the page's unload event.


"daveh551" <(E-Mail Removed)> wrote in message
news:426127bf-8846-4ba9-910b-(E-Mail Removed)...
> On Aug 4, 10:13 pm, "Scott M." <s-...@nospam.nospam> wrote:
>> It's a client side event, not a server side (ASP .NET) event. It's
>> simply
>> the unload event.
>>
>> "daveh551" <gee...@gmail.com> wrote in message
>>
>> news:204a3f91-4c42-48a3-b53c-(E-Mail Removed)...
>>
>> > Okay, I feel like this is probably a stupid question, but...

>>
>> > I have accessed sites that are pushing some scam that, when you go to
>> > leave the page it will pop up a box saying, "No, don't go, let our
>> > live agent talk you into buying our junk."

>>
>> > My question is, what event do they use to tell that you are leaving
>> > the page? Looking through the events available in the Page class, I
>> > see a lot that take place when the page is initiated, but nothing that
>> > is triggered when the user leaves.

>>
>> > What am I missing?

>>
>> > Thanks for your help.

>
> Thanks, both of you. That makes sense.
>
> Follow on question, and dont feel compelled to answer it because Im
> sure I can dig a little and find the answer on my own, but what kind
> of javascript code would I write to reflect that event back to the
> server to do something with there?(I.e, I want to record the time the
> user spent on a page in a database for statistical analysis, so I need
> to record when they leave.)



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Is there a way to tell if a user is leaving the page? Chris Roden Microsoft ASP .NET 4 13th Dec 2007 07:51 PM
Warn user before leaving page with unsaved changes markalroberts@gmail.com Microsoft ASP .NET 4 25th Oct 2005 05:55 PM
Leaving a Page brian Microsoft ASP .NET 4 12th Jun 2004 02:12 AM
Control Tabs - Preventing user from leaving page Patrick GRaham Microsoft Access Form Coding 1 14th Oct 2003 12:31 PM
Detecting Column Data Change without Leaving Row Jerry Microsoft Dot NET Framework Forms 1 30th Jul 2003 11:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:48 AM.