I have a back button in my application which on click should return to parent page. I am using history.back()
for the purpose . However I am not able to prevent it from going back to login.
Use the document.referrer
to check the previous clicked link :
if(document.referrer !="http://myloginpage"){ // different then the url login then go back
window.history.back()
}