Reputation: 1
I have a back button on my application. When users come from another domain to mine. How can I know from which URL user landed on my application?
I would like to redirect the user to the URL they have come with when they click on my "Go back` button.
Thanks
Upvotes: 0
Views: 235
Reputation: 393
There are couple of ways for doing that 1. By using document var prevURL = document.referrer;
Upvotes: 0
Reputation: 44969
You don't need to replicate the browser's functionality as they already do that perfectly fine.
But if you really want to, you can just use history.back()
. And if you really really want to know where the user came from, you can use document.referrer
.
Upvotes: 1