A visitor wants to leave the page (reload, refresh, close tab..etc.), and then a function is triggered prompting a modal "are you sure you want to leave?".
I want to allow them to leave the page without the modal prompt if they click on a link.
Here is a jsfiddle example- http://jsfiddle.net/vvj90z8h/3/
<a href="http://www.google.com" class="button">Proceed</a>
<div class="price">$139.99</div>
// function
priceFunction = function (){
window.onbeforeunload = function() {
return 'Sure you want to leave?';
}
};
// if price is 139.99, run function
var price = $(".price").text().replace(/[^0-9\.]/g, '');
if (price = 139.99){
priceFunction();
}
If you refresh the page, the modal shows, which is okay.
I'm wanting to click the link and not have the modal show.