Vignesh packiaraj
Vignesh packiaraj

Reputation: 583

Preserve URL hash between HTTP redirects

I am working on an offers site and we are developing a functionality to send the offers listed in our page in an email to the end user. In our webpage there is a section called Offers with the enclosed tag id as Offers. When the user clicks the link in url Link: https://www.test.com/service#Offers Expectation: The service page should be loaded and it should scroll to Offers sections This is working when the user is already signed in. But when the user is not signed in , the user request will be forwarded to the sign in page and then it reverts to the /service. But this time, # anchor is missing in url https://www.test.com/service and so scrolling is not happening. Please help me how can i solve this issue. is it advisable if i can replace it with https://www.test.com/service?Offers Please advice.

Upvotes: 3

Views: 255

Answers (1)

Guerric P
Guerric P

Reputation: 31835

Your problem is related to your frontend which doesn't send the anchor in the URL to the backend because it represents a frontend state (this is by design and cannot be changed). So when the login page keeps the return URL in session and then redirects after login, the redirection doesn't contain the anchor because the backend simply doesn't have it.

If your login is based on HTTP redirects, the web doesn't offer any native solution to your problem.

Upvotes: 2

Related Questions