if(targ.href && ! isAllowedDomain(targ.href)){blah}
YAHOO.util.Event.element(e) ;
if(targ.href && ! isAllowedDomain(targ.href) ){blah}
Hi,
Disclaimer - I'm new to YUI, so go easy on me :)
I'm attempting to create a simple exit survey that will only trigger
when a user goes offsite to a different domain. No other event/action
should generate this popup.
I found some code on Matt Sniders site that partially implements it,
but too many details left out to create a fully functioning piece.
I've been able to get parts of it working, but I get an error with a
line like this:
YAHOO.util.Event.element(e) ;
if(targ.href && ! isAllowedDomain(targ.href) ){blah}
I'm needing to check the name of the domain so that I know if I should
popup the message, but this obviously isn't working.
Any thoughts on this?
Is there a better way to create on unload popup?
Any help with pointers on how to use the YUI to create an exit survey
would be much appreciated.
Thanks,
Matt
www.pairs-list.com
---------------- CODE SNIPPET BELOW ------------ --
YAHOO.util.Event.addListener( window,window. beforeunload? 'beforeunload' :'unload, isShowable) ;
var showPopup = function() {
window.open('/survey. php','misc_ win','status= off,toolbar= off,location= off,menubar= off,directories= off,resizable= off,scrollbars= off,height= 500,
width=500');
};
function isShowable(e){
if(!isAllowedDomain(YAHOO.util. Event.element( e).href){
var y = YAHOO.util.Event.getPageY( e);
if(y<=0){
var x = YAHOO.util.Event.getPageX( e);
if(x>20) {
showPopup();
} else if(x <=0 ){
showPopup();
}
}
}
};