How to get the previous URL in JavaScript?

Is there any way to get the previous URL in JavaScript? Something like this:

alert("previous url is: " + window.history.previous.href);

Is there something like that? Or should I just store it in a cookie? I only need to know so I can do transitions from the previous URL to the current URL without anchors and all that.

8 Answers
8

Leave a Comment