Here the link has been set with a picture. If user click the picture, they will be ask to leave or stay in my-website. If leave clicked the they will be directed to link-website. The problem is, if I want to go to anyother page within my website from this part, it still request leave or stay. I want that the reqruest will be only for the link but not for mywebsite´s pages. I know that I have to make a condition, to check. But no clue how to do it.
<body onbeforeunload="return myFunction()">
<a href="http://link-website.com/"><img class="alignnone wp-image-1353 size-full"src="http://my-website/wp-content/uploads/2015/07/picture-name.png" alt="picture-name" width="xxx" height="xxx" /></a>
<script>
function myFunction() {
return "Are you sure ";
}
</script>
</body>