So I have a html document that is located at localhost/r/index.php, but when I do window.location.href="localhost" it sends me to locahost/r/localhost which I don't want. I want my script to send me to localhost. Is there a way to do this?
You use / to denote the root directory of your webserver:
window.location.href="/";
Or, you can use a full url:
window.location.href="http://localhost";
window.location.href="localhost" =>
window.location.href="/"
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