'local storage get item will gone when i refreshing the page

im new javascript learner,and i have problem to display the local storage.getitem value when i will refresh the page,can any one help me please,and thank you for the help,this is my code;

function myFunction() {
  var c = document.getElementById('myinput').value;
  historyarr.push(c);

  localStorage.setItem('user', JSON.stringify(historyarr))
  console.log(typeof(historyarr))
  displayonpage(historyarr)
}

function displayonpage(c) {
  return result.innerHTML = JSON.parse(localStorage.getItem('user')).join('<br>')
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source