HTML URL


May 02, 2021 14:31 HTML


Table of contents


HTML Uniform Resource Locators


The URL is a web address.

URLs can consist of letters such as "w3cschool.cn", or Internet Protocol (IP) address: 120.79.88.157. Most people go to the site and use the site domain name to access it because the name is easier to remember than the number.


URL - Unified Resource Locator

The web browser requests the page from the web server via a URL.

When you click on a link on an HTML page, the corresponding label points to an address on the World Wide Web.

A Unified Resource Locator (URL) is used to locate documents on the World Wide Web.

An example of a web address: // www.w3cschool.cn/html/html-tutorial.html syntax rules:

scheme://host.domain:port/path/filename

Description:

    • Scheme - Defines the type of Internet service. The most common type is http

    • host - Define domain hosts (http's default host is www)

    • Domain - Defines Internet domain names, such as w3cschool.cn

    • :p ort - Defines the port number on the host (http's default port number is 80)

    • path - Defines the path on the server (if omitted, the document must be in the root of the Web site).

    • filename - Defines the name of the document /resource


Common URL Schemes

Here are some URL schemes:

Scheme 访问 用于...
http 超文本传输协议 以 http:// 开头的普通网页。不加密。
https 安全超文本传输协议 安全网页,加密所有信息交换。
ftp 文件传输协议 用于将文件下载或上传至网站。
file 您计算机上的文件。



URL character encoding

The URL can only use the ASCII character set.

URL encoding converts characters to a format that can be transmitted over the Internet. to be sent over the Internet, because URLs often contain characters other than the ASCII collection, the URL must be converted to a valid ASCII format.

URL encoding replaces non-ASCII characters with "%" followed by two heteens.

The URL cannot contain spaces. URL encoding usually replaces a space with a .


Online instance

If you click the Submit button, your browser will URLcode it before sending the input. The page on the server displays the input received.

<form name="input" target="_blank" action="form_action.php" method="get">
<input type="text" value="w3cschool.cn" name="text" size="30">
slt;input type, "submit" value, "submit"
</form>

Try it out . . .

Click the "Try it" button to view the online instance

HTML URL Tip: JavaScript, PHP, and ASP all provide functions for URL encoding strings.


The URL encoding instance

字符 URL 编码
%80
£ %A3
© %A9
® %AE
À %C0
Á %C1
 %C2
à %C3
Ä %C4
Å %C5

For a complete URL encoding reference, please visit our URL encoding reference manual.