SoFunction
Updated on 2025-03-07

When the user exits and clicks the browser and returns to the original page, the solution is to return to the original page.

Solution 1: Disable cache. The previous method used is fine on the browser on the computer, but there are still problems on the iPad and Android phones.

Solution 2: Disable the browser back key javascript: (1); The result is the same as the solution, but there is no effect on the pad

Solution 3: ("<script>('')</script>"); It can still go back, it feels worse than 1 or 2, but adding an onclick event in the front desk does not involve form submission, it is actually OK, so here we go to Solution 4

Solution 4: Use ajax, clear the session in the ajax page, and then add js to the current page

function logout(isLogout) {
if (isLogout != "") {
$.ajax({
url: "ajax/",
data: "code=" + encodeURI(isLogout), cache: false,
datatype: "html",
success: function (context) {
LogoutReturn(context);
}
});
}
else {
return "Error";
}
}
function LogoutReturn(context) {
if (context == "success") {
('');
}
}

The above content is the solution introduced by the editor to you when the user logs out and clicks on the browser and returns to the original page. I hope it will be helpful to everyone!