I have a question , this is my code :
<a href="Webshop.php" class="Button" onclick="myFunction()">Webshop</a>
<script>
    function myFunction() {
        var r = confirm("If you leave this page your purchase will be gone!");
        if (r == true) {
            window.location = "http://www.titansafes.sgr15.g-o.be/Webshop.php";
        } else {
            return
        }
    }
</script>
If you click on the button I get the alert , if they click ok , they direct back to the webshop , if they click cancel , they need to stay on the page. But how can I do that best? I tried Window.location ( doesn't work ), return doesn't work , and it's quite important for me.
 
     
     
     
     
    