Skip to content Skip to sidebar Skip to footer

Setting Window.location.href Not Working As Expected

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

Solution 1:

As a # in a URL mark an anchor, the changing of it don't trigger a page load as your bas url (foo.com/) stay the same. The window.location.href isn't ment to hadle anchor change.

If you whant to change the "anchor" part, you must use the window.location.hash for it to be detected (as in your second exemple)


Solution 2:

Every browser has a URL length limits! the shortest one is Internet Explorer which is 2083 characters! Check it out here

And all webkit browsers Chrome, Safari, Mozilla has a limit of 100KB! You can get more details here


Post a Comment for "Setting Window.location.href Not Working As Expected"