Find last visited url in javascript with history

I know about document.referer, and that’s not what I’m looking for. This may be a solution, but I want to get it in local mode without using a server.

Steps:

  • I click the new state in the current URL of my page using history.pushState('','','#test')

  • I will go to the next page.

  • And now I want to get the url, but history.previous was deleted from Gecko 26 .

Is there any other way to get this value other than using cookies or sessionStorage?

+4
source share
2 answers

So, my problem was that for this purpose there are no options in a local without a server environment.

, , , , , , , .

sessionStorage.setItem('foo',val) sessionStorage.getItem('foo').

0

- , :

http://server.com/next-page-address/whatever.html?prevData=RequiredStateData

, , , , RequiredStateData . , .

0

Source: https://habr.com/ru/post/1657724/


All Articles