Reputation: 739
I have a login.asp page. Whenever the session expires, the user is given a link to the login page to log in. After logging in, users need to go back to the original page from which the link was clicked. How do I get the address of that webpage?
Upvotes: 2
Views: 68
Reputation: 18538
There is a property of the document object called referrer
For example link to your website was clicked from http://example.com, you can use document.referrer
to get http://example.com
Ref - https://www.w3schools.com/jsref/prop_doc_referrer.asp
Upvotes: 0
Reputation: 9916
You could redirect him to
/login.asp?next=url-of-where-the-user-tried-to-go
Once he logs in, redirect him to the parameter next
. This is extremely common.
Upvotes: 1
Reputation: 114367
You have to grab the referrer
when the user is redirected to the login page. Store that and redirected the user back after the login process.
Upvotes: 2