I need an alert box before I allow the user to return to the previous page. How can I modify the following code to utilize the history.back(); functionality?
function alertURL(url) {
if(confirm(“Are you sure you want to go to kfc.com?”)){
location=url;
}
}
Mittineaque - Thanks for the response. This is what I tried:
In the header:
function confirmExit() {
check = window.confirm(“Are you sure you want to exit without saving your changes?”);
if (check == true){
location=history.back();
}
}
In the body:
<a href=“#” onClick=“confirmExit()”>Return to Previous Page</a>
I’m sure its a simple syntax error. Can you make any recommendations?