Hi,
You can return false then it will stays on current page only. other wise in else part you can put alert to check its coming to else part or not
like this
function confirmation() {
var answer = confirm(window.close());
if (answer){
alert("Bye bye!")
window.location = "http://www.yahoo.com/";
}
else{
alert("Thanks for sticking around!")
}
}