我的应用程序中有一个后退按钮,单击该按钮应返回到父页面。我使用 history.back()
来达到目的。但是我无法阻止它返回登录。
最佳答案
使用document.referrer
检查之前点击的链接:
if(document.referrer !="http://myloginpage"){ // different then the url login then go back
window.history.back()
}
关于javascript - 如何防止history.back()返回登录页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43965404/