Solution that can still return to the original page when the user exits and clicks back on the browser
- 2021-09-12 01:53:24
- OfStack
Solution 1: Disable caching. The previous method is fine in all browsers on the computer, but it still has problems on ipad and Android phones
Solution 2: Disable the browser back key javascript: window. history. forward (1); The result is similar to the result of scheme 11, and it has no effect on pad
Solution 3: Response. Write ("
<
script
>
window.location.replace('login.aspx')
<
/script
>
"); Still can go backwards, feeling not as good as 1, 2, but add an onclick event in the foreground, does not involve form submission, actually can, from this to scheme 4
Solution 4: With ajax, empty session in the ajax page and add js to the current page
function logout(isLogout) {
if (isLogout != "") {
$.ajax({
url: "ajax/logout.aspx",
data: "code=" + encodeURI(isLogout), cache: false,
datatype: "html",
success: function (context) {
LogoutReturn(context);
}
});
}
else {
return "Error";
}
}
function LogoutReturn(context) {
if (context == "success") {
location.replace('login.aspx');
}
}
The above content is this site to introduce to you when users exit the browser back can still return to the original page of the solution, I hope to help you!