Why does an anchor tag's href values need http:// preprended to the URL?

前端 未结 4 1855
感动是毒
感动是毒 2020-12-01 12:29
click here

Clicking the above link on a site\'s HTML page would try to take the

4条回答
  •  粉色の甜心
    2020-12-01 13:00

    There are several protocols: HTTP, HTTPS, FILE, SSH, SSL, FTP. In addition, as Jeremy mentioned, it's quite possible you may have a file on your server with the exact name of the text you're entering in the HREF.

    Basically, any text in the href without a protocol is assumed to be a relative path if there is no / or protocol.

提交回复
热议问题