I am currently working on a ruby on rails project and I am doing some raw javascript with jquery. I want to redirect my root domain, localhost:3000, from localhost:3000/home.
To achieve this I have to following code:
window.location.replace('localhost:3000');
This doesn't bring me back to my main page, but instead back to the homepage localhost:3000/home/ or does nothing.
However I tried a different domain, stackoverflow.com, and this worked
window.location.replace('http://stackoverflow.com/');
The url is valid so I don't know what could be wrong with redirecting to the localhost. Is this a security issue with the routing or does this have to do with the fact that I am working on a localhost? Any help on this manner would be greatly appreciated. Thank you!
您的网址中缺少“ http://”。
window.location.replace('http://localhost:3000');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.