Here is an example.
1) I open google.com. Object looks like this:
{
  url: 'https://www.google.com/',
  previous: '',
  referrer: ''
}
2) Then I click on the link /news and the object looks like this:
{
  url: 'https://www.google.com/news',
  previous: 'https://www.google.com/',
  referrer: 'https://www.google.com/'
}
3) Then I open a new tab and go to https://stackoverflow.com/ and the object looks like this:
{
  url: 'https://stackoverflow.com/',
  previous: 'https://www.google.com/news',
  referrer: ''
}
How to achieve it? I tried with window.localStorage but it doesn't work.