I am developing a google app engine app. I am trying to redirect user to login page when a button is clicked. To do this I set window.location.pathname
to following string /_ah/login?continue=http%3A//localhost%3A8080/
. However, chrome escapes the string so that the full URL becomes http://localhost:8080/_ah/login%3Fcontinue=http%3A//localhost%3A8080/
, and this gives a 404 error. How can I prevent this from happening? The URL that works is http://localhost:8080/_ah/login?continue=http%3A//localhost%3A8080/
window.location.pathname returns the path and filename of the current page. window.location.protocol returns the web protocol used (http: or https:) window.location.assign() loads a new document.
window. location. href is not a method, it's a property that will tell you the current URL location of the browser. Changing the value of the property will redirect the page.
pathname. The pathname property of the Location interface is a string containing the path of the URL for the location, which will be the empty string if there is no path.
Set window.location.href
instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With