I tried running html and css in VSC but when Chrome opens, i had the error "This site can't be reached. localhost refused to connect". What am I supposed to do? enter image description here
CodePudding user response:
Did you first set up a server? If you need to, and you have python installed, try doing this:
python -V
# If the above fails, try:
python3 -V
# Or, if the "py" command is available, try:
py -V
# If Python version returned above is 3.X
# On Windows, try "python -m http.server" or "py -3 -m http.server"
python3 -m http.server
# If Python version returned above is 2.X
python -m SimpleHTTPServer
If it still is not working, make sure that you are on the right port.
Source: MDN
CodePudding user response:
Basically Google Chrome redirecting localhost to https. As you did not provide that much information but you can follow below steps. I am assuming this is caused by HSTS.
- Please open this chrome://net-internals/#hsts in your browser.
- Then Please Go down of the page and find Delete domain security policies.
- In the input field please enter "localhost".
- Restart browser.
This might resolve your issue