Show toastr once after succesful login

Viewed 80

I want to show only once toastr notification after the user has a successful login. If the user tried to reload the page or the user redirect to another page, I don't want to reshow the notification. Is that possible?

1 Answers

You can achieve that with local.storage():

Window.localStorage

var isLogged = localStorage.getItem("isLogged");

if(!isLogged){
    alert('notification');
}

localStorage.setItem("isLogged", true);


//on logout or window.onbeforeunload remove from local storage
//localStorage.removeItem("isLogged");

Example: localStorage example

NOTE: to check stored items go to browser console under Application tab Local Storage section

Related