URL
Web浏览器通过使用URL从Web服务器请求页面。当我们点击页面上的一个链接时,该连接是一个指向web地址的a标签。
一个web地址如http://www.w3schools.com/html/default.asp的语法规则如下:
scheme://host.domain:port/path/filename
备注:
- scheme - 定义互相网络服务的类型 (most common is http)
- host - 定义域名主机 (default host for http is www)
- domain - 定义域名(w3schools.com)
- port - 定义虚拟主机上的端口号(default for http is 80)
- path - 定义服务器上的地址(If omitted: the root directory of the site)
- filename - 定义资源或者是文件的名字
常用的URL schema
Scheme | Short for | Used for |
http | HyperText Transfer Protocol | Common web pages. Not encrypted |
https | Secure HyperText Transfer Protocol | Secure web pages. Encrypted 加密 |
ftp | File Transfer Protocol | Downloading or uploading files |
file |
| A file on your computer |
URL Encoding
URLs can only be sent over the Internet using the ASCII character-set. If a URL contains characters outside the ASCII set, the URL has to be converted.
URL encoding converts non-ASCII characters into a format that can be transmitted over the Internet.
URL encoding replaces non-ASCII characters with a "%" followed by hexadecimal digits.
URLs cannot contain spaces. URL encoding normally replaces a space with a plus (+) sign, or %20.
HTML URL Encoding Reference
http://www.w3schools.com/tags/ref_urlencode.asp