Jump to content

Javascript popup still "popping" on internal links

- - - - -

  • Please log in to reply
1 reply to this topic

#1
chedchedched

chedchedched

    Newbie

  • Members
  • Pip
  • 1 posts
I am using this code:

<script type="text/javascript" language="javascript"> 

 

var areYouReallySure = false;

 

var internalLink = false;

 

function areYouSure() {

 

if (!areYouReallySure && !internalLink) {

 

areYouReallySure = true;

 

location.href="http://www.oursite.com/"

 

return "*****************************************************\n\WAIT BEFORE YOU GO YOU MUST READ THIS!! \n\nDid you know that this is a LIMITED TIME offer that is discounted over 60%? This WILL NOT last long!\n\nTo claim your lmited time package, click STAY ON THIS PAGE and fill out the form.\n\nClick STAY ON THIS PAGE to get this LIMITED TIME offer!\n\n*****************************************************";

 

}

 

}

 

window.onbeforeunload = areYouSure;

 

</script>

With this (at our call to action button):
 <form id="icpsignup4333" name="form1" action="https://app.icontact.com/icp/signup.php" method="post" accept-charset="UTF-8" internalLink="true"><input type="hidden" name="redirect" value="http://www.oursite.com/checkout.php" /> <input type="hidden" name="errorredirect" value="http://www.icontact.com/www/signup/error.html" /> 

Here's the problem:
It works in Google Chrome, but not Safari or Firefox - why not? By not working, i mean once that button is clicked (to checkout) the popup still comes up.

Is there a better code i should be using, if so, what?

Thanks in advance!

#2
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,722 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
Try deleting the var keyword when declaring areYouReallySure and internalLink. That should force them to be global.
sudo rm -rf /




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users