Working on a Chrome Extension that allows users to keep a list that uses localStorage.
Working so far: user can input things in their list and it will store in localStorage, user can delete things from the list and it disappears from localStorage.
Trying to figure out: how can I start the user with a few sample items on their list?
function startStorage (){
localStorage.setItem('list', 'your first list item');}
startStorage();
The above code's issue: every time the user refreshes the page it would populate the starting items again. Is there a way to populate only once? As of now, function fires everytime they reload so they get the starting items again.
Any thoughts are appreciated, thanks.