javascript - Setting window.location vs. typing url? -


my main question in bold @ bottom. love answer if you'd me figure out rest of problem, please continue reading.

i working on web application session expiration being handled spring backend (it's default tomcat 30-minute session expiration). if logged application , type in 'www.myapplication.com/portal/logout' (not real url, obv.) logged out , redirected login page. great. however, if set

window.location = 'http://www.myapplication.com/portal/logout'  

in client-side javascript, url appears in url bar in browser whitelabel error page results being generated service on backend.

why there difference between typing url versus setting window.location in code? should there difference? or think other service funking redirection? if so, why same error not occur when type url?

ps. tried window.location.href = url , window.location.replace(url), same effect.

you should try:

window.location.assign(url); 

Comments