Click here to Skip to main content
15,894,312 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi I have a problem with my website where if i sign in with a user then sign out and sign in with a different user.
if i press the browser back button it will take me to the page of the first user not the user i am currently logged in with.I am using an ajax application. Is there a plugin or some code i can write that will tell the browser back button to mimic an ajax call?
Posted

You can use
HTML
<script type="text/javascript">
       window.history.forward(1);
   </script>

in Master page or Normal page to disable back button.
 
Share this answer
 
Use the below code on the page(head) which you want to prevent to be landed using back button.
C#
<script type="text/javascript">
  function preventBack() { window.history.forward(); }
  setTimeout("preventBack()", 0);
  window.onunload = function() { null };
</script>
 
<script language="JavaScript" type="text/javascript">
  javascript: window.history.forward(1);
</script>

Regards :laugh:
 
Share this answer
 

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