Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Determining when a person leaves your domain


  • From: allard-schripsema at procergs.rs.gov.br (Allard Schripsema)
  • Subject: [Javascript] Determining when a person leaves your domain
  • Date: Wed Jun 22 13:02:48 2005

hi Matt,
The back button works because the page in the frame is loaded, not the
frameset.
But i can?t seem to catch the event when a user changes the address in the
addressbar though... (strange, shouldn?t that fire the onunload()?)

Better then nothing? I?m inclined to agree with Mike, let the user go when
he wants to leave.... Find another way to query the user about what you want
to know.

Anyway a bit of code to play with (to keep the customers happy :-)
The top.reloaded is to check if the reloadbutton is pushed.
(don't forget to put it in a frame)

<html>
<head>
<title>Untitled</title>
</head>
<script>
function clearBool(){
	if (typeof top.abandonBool == "undefined"){
		 top.reloaded=true
	}
	alert("clearBool:" + top.abandonBool)
	top.abandonBool=true
	alert("clearBool:" + top.abandonBool)
}
function setBool(){
	alert("setBool: " + top.abandonBool)
	top.abandonBool=false
	alert("setBool: " + top.abandonBool)
	top.reloaded=false
}

function getBool(){
	alert("getBool: " + top.abandonBool)
	if (typeof top.abandonBool != "undefined"){
		if ((top.abandonBool)&&(!top.reloaded)){
		  alert("abandoner!")
			 top.abandonBool=true
			 return false
		}else{
			 return true
		}
	}
}
</script>
<body onLoad="clearBool()" onunload="getBool()" >
bla bla<br>
<a href="javascript:setBool();this.location.href='subpage.htm'">internal
link </a><br>
more bla bla
<a href="javascript:this.location.href='externalpage.htm'">external link
</a><br>

</body>
</html>


Allard Schripsema
www.visualdigital.com.br


-----Original Message-----
From: javascript-bounces@xxxxxxxxxx
[mailto:javascript-bounces@xxxxxxxxxx]On Behalf Of Matt Barton
Sent: Wednesday, June 22, 2005 11:30 AM
To: [JavaScript List]
Subject: Re: [Javascript] Determining when a person leaves your domain


That won't solve the problem Jessica is having with the browser
navigation buttons though.

A visitor would still see the confirm dialog when hitting the 'back'
button on the browser, since there's no way to tie an event to the
browser button which sets the value of the flag accordingly.

Matt


Allard Schripsema wrote:
> You might try this (just an idea):
>
> You must have a frame around your site.
> Every link, menuItem etc in the site will set a boolean in the top of the
> frame to true
> Every onload of the page will reset the boolean to false
> Every unload of the page will check if this boolean is true or false and
act
> accordingly
>
> hope this helps,
>
> Allard Schripsema
> www.VisualDigital.com.br
>
> -----Original Message-----
> From: javascript-bounces@xxxxxxxxxx
> [mailto:javascript-bounces@xxxxxxxxxx]On Behalf Of Jessica Mays
> Sent: Wednesday, June 22, 2005 11:07 AM
> To: [JavaScript List]
> Subject: RE: [Javascript] Determining when a person leaves your domain
>
>
> Again I want to stress that I do not want to annoy people, and this
> action would happen on one page only. And if they have JavaScript
> disabled they just don't get the survey - I can accept that.
>
> But this is for an abandonment survey and I don't want them to be able
> to take it before they "really" decided to abandon - there could be
> offers associated and I can't have them coming up too soon.
>
> So in JavaScript can I tell if they are using the back button or
> refreshing the screen (perhaps not a full tracking if they are staying
> on the site or not)? (again keeping the annoyance level to a minimum)
>
> -------------------------
>
> Jessica Mays
>
> -----Original Message-----
> From: javascript-bounces@xxxxxxxxxx
> [mailto:javascript-bounces@xxxxxxxxxx] On Behalf Of Matt Barton
> Sent: Wednesday, June 22, 2005 9:35 AM
> To: [JavaScript List]
> Subject: Re: [Javascript] Determining when a person leaves your domain
>
> Hi,
>
> I think there's probably some milage in considering Mike's suggestion to
> "let people choose [the survey link] voluntarily through an easily
> visible link".
>
> I can't personally think of an all-encompassing JavaScript solution to
> your goal, but even if one existed (which I doubt), it would be
> worthless for any visitor to your site who has JavaScript disabled (and
> there are plenty of those out there).  Such visitors wouldn't know about
> your survey unless there was a clear link to it.
>
> FWIW
>
> Matt
>
>
> Jessica Mays wrote:
>
>>Annoyance is one of the reasons I want to make this come up as little
>
> as possible.
>
>>And this is for a survey so the confirm box just asks if you would
>
> like to survey or not and if no you go on your merry way and if you say
> yes you are sent to the survey.   This is an simple opt-in, and I am
> trying to keep annoyance to the lowest level possible.
>
> _______________________________________________
> Javascript mailing list
> Javascript@xxxxxxxxxx
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
> _______________________________________________
> Javascript mailing list
> Javascript@xxxxxxxxxx
> https://lists.LaTech.edu/mailman/listinfo/javascript
> --
> This email has been verified as Virus free
> Virus Protection and more available at http://www.plus.net
>
_______________________________________________
Javascript mailing list
Javascript@xxxxxxxxxx
https://lists.LaTech.edu/mailman/listinfo/javascript