Exit Popup Advice Needed

4 replies
Greetings Warriors!

I know there are gaZillion ways to do exit popups. Not a huge fan of them, but sometimes only way to grab attention.

My issue with simple one trying is, the exit popup appears when visitor clicks order button. Do not want the exit popup to appear when clicking link (URL), ONLY when user exits page by closing, back, forward and so on.

This is what I am using in page:
Code:
  <head>
     <script src='xo.js'></script>
     <script>
			unloaderxo.
			   init({
				 url : 'http://example.com',
				 msg : 'DO NOT LEAVE EMPTY HANDED! Get My FREE Pro Version...\n'+
					   'Click the cancel button or stay on page and t download FREE pro version!'
				   })
     </script>
  </head>
Here is the contents of the xo.js:
Code:
var unloaderxo =
  {
   count : 0,
   params : {msg : "OK"},
   ask : function(e){
	    window.onbeforeunload = function(){};
	    setTimeout(unloaderxoGo,150);
	    return this.params.msg;
	},
	
   init : function(p)
     {
		 this.params = p;
		 window.onbeforeunload = unloaderxoAsk;
	 }
  }//var
  
  
function unloaderxoGo()
{  
    if(unloaderxo.count >= 7) // make sure we get a full timeout
      {
  	 
  	  if(unloaderxo.params.url)
	    location.href = unloaderxo.params.url;
     
      }
	else
	  {
	  unloaderxo.count++;
	  setTimeout(unloaderxoGo,150);
      }//else
	
}//func


function unloaderxoAsk(e)
{
return unloaderxo.ask(e);	
}
Thinking there would be a way to add code to href tag to prevent popup on URL, but be darned if I can grasp it. Forehead sore from banging on desk

Any ideas? Have exhausted all mine.

Or any better suggestions?

Thanks!
#advice #exit #needed #popup
  • Profile picture of the author Terry Jett
    Thanks for PM Bill!

    Your tweak fixed but FF will not show message. Least the URL do not rigger the popup alert though.

    Appreciate it and also signed up for your affiliate offer mentioned.

    Terry
    {{ DiscussionBoard.errors[8095718].message }}
    • Profile picture of the author Blakos
      Make life easier for yourself and use the
      Code:
      onunload
      event, like so:

      HTML Code:
      <!DOCTYPE html>
      <html>
      <head>
      <script> 	function welcome_message() 	{ 		alert("Note: This website is still being developed to be compatible with all known devices. Some layout errors may still exist."); 	} 	</script>
      </head>
      <body onunload="myFunction()"> </body>
      </html>
      {{ DiscussionBoard.errors[8111909].message }}
    • Profile picture of the author Blakos
      Make life easier for yourself and use the
      Code:
      onunload
      event, like so:

      HTML Code:
      <!DOCTYPE html>
      <html>
      <head>
          <script>     function exit_message()     {         alert("Exit message here...");//Or code...     }     </script>
      </head>
      <body onunload="exit_message()"> </body>
      </html>
      {{ DiscussionBoard.errors[8111912].message }}
  • Profile picture of the author Terry Jett
    Thank you Blake!

    I will give this a run on Tuesday.

    Appreciate your input very much,

    Terry
    {{ DiscussionBoard.errors[8112385].message }}

Trending Topics