If the user is at url foo.com/#/veryLongToken and the response.redirectUrl
is foo.com/#/veryLongToken/resultToken , in the first example, when the page is reloaded we end up at foo.com/#/veryLongToken.
In the second example, we end up at foo.com/#/veryLongToken/resultToken which is what we expect.
More info;
- The URL is very long
- AngularJS window-wrapper $window is used
- Tested in Chrome and Safari, both displaying same behaviour
Doesn't work:
function successHandler(response) {
$window.location.href = response.redirectUrl;
/* redirectUrl might contain only changes to the hash-fragment
which is why we force a reload here */
$window.location.reload();
}
Works;
function successHandler(response) {
$window.location.hash = response.redirectUrl.substr(response.redirectUrl.indexOf('#'));
$window.location.reload();
}
I'd really like to know why the first example doesn't work. Any ideas?
response.redirectUrl
is