6

The page url is http://example.com/dashboard#/catalog. When the cookie expires, I do a

res.redirect('/login')

And the resulting url in the browser is http://example.com/login#/catalog.

How could I redirect without the hash part i.e Make the url to be http://example.com/login

Thanks for your help!!

Sachin
  • 20,754
  • 28
  • 93
  • 162
omgMaya
  • 181
  • 2
  • 2
  • 12

1 Answers1

0

I don't know how you are doing the logout part, but assuming you're using a link tag you could do something like this

$("a#logout").on('click', function() {
  // the following was taken from http://stackoverflow.com/questions/4508574/remove-hash-from-url
  var loc = window.location.href,
      index = loc.indexOf('#');
  if (index > 0) {
     window.location = loc.substring(0, index);
  }
});
muZk
  • 2,708
  • 20
  • 22