I am working on a project in which i need to handle browser back button and on it's click I want to redirect to home page.
I have gone through many post, there are a lot of ways to implement it.
I am wondering, what is the best way to implement it.
If anyone knows similar post, please post the url.
Thanks for help
I have used the following codes:
function HandleBackFunctionality()
{
alert('ckikc')
if(window.event)
{
if(window.event.clientX < 40 && window.event.clientY < 0)
{
alert("Browser back button is clicked...");
}
else
{
alert("Browser refresh button is clicked...");
}
}
else
{
alert('clicked')
if(event.currentTarget.performance.navigation.type == 1)
{
alert("Browser refresh button is clicked...");
}
if(event.currentTarget.performance.navigation.type == 2)
{
alert("Browser back button is clicked...");
}
}
}
window.onbeforeunload = HandleBackFunctionality;
$(document).unload(HandleBackFunctionality);
well its not working for me :(
well @kapa said it is a duplicate question, I have mentioned that have googled a lot for this and have seen a lot of solutions for this problem.
my question is not the way to solve it, but the best solution out of available one