0

Currently I am working in angular js and j2ee frameworks.

Currently I am http:something.com/home/#/main

But if i am redirect the above url from java servlet using response.sendRedirect("http:something.com/login/")

It redirects me to the page but in browsers url "#/main" remains even after redirecting like below....

http:something.com/login/#/main.

I don't want that angulars state after my redirection.

Thanks in advance

Kumar Raj
  • 35
  • 1
  • 4

1 Answers1

0

The prevailing browser behaviour is to preserve URL fragments after redirects.
If the location in the redirect contains a URL fragment, then it will override any carried over URL fragment.

So what you could do is simply append an empty URL fragment (hash mark #) to your redirect so that it clears anything being carried over.

response.sendRedirect("http://something.com/login/#")
Community
  • 1
  • 1
Magnus
  • 7,952
  • 2
  • 26
  • 52