Click here to Skip to main content
15,912,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Friends,


Please help me on browser back button it should not take me previous page instead of that it should take me MypageName.aspx

Thanks
Renuka
Posted

Please visit this link for more detail.
http://msdn.microsoft.com/en-us/library/x3x8t37x(v=vs.90).aspx[^]
 
Share this answer
 
Hi

XML
<script type="text/javascript">
        function DisableBackButtonAllBrowsers() {
            window.history.forward();
        };
</script>
<pre lang="text">add <body onload="DisableBackButtonAllBrowsers"> of thanks.aspx page. works fine with firefox.


Try this link Solution to Browser Back Button Click Event Handling[^]
 
Share this answer
 
v2
Comments
Renuka Ruke 10-Apr-14 5:58am    
i am using asp.net where should i call this function
Ajith K Gatty 10-Apr-14 6:18am    
Depends on your requirement. If from every page it should redirected to MyPageName.aspx then call the script from body of master page.
Renuka Ruke 10-Apr-14 8:06am    
i want to redirect only in one page
e.g
if the user place order from billing page and finalize the payment next page is thanks.aspx .
from this thanks.aspx he should not able to go back again billing.aspx , i want prevent like this
Ajith K Gatty 11-Apr-14 0:40am    
implement that in thanks.aspx page then...
Renuka Ruke 11-Apr-14 2:04am    
i have written like this but is not working

<script type="text/javascript" language="javascript">
window.onbeforeunload = HandleBackFunctionality();
function HandleBackFunctionality() {
alert("jio");
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 {
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...");
}
}
}


</script>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900