Home > Article > Web Front-end > The use of url, href and src in JS
This time I will bring you the use of url, href, and src in JS. What are the precautions for using url, href, and src in JS. The following is a practical case. Let’s take a look. .
1. The concept of URL
Uniform Resource Locator (or Uniform Resource Locator/location address, URL address, etc., English: Uniform Resource Locator, often abbreviated as URL), sometimes also commonly known as web address (web address). Just like a house number on the Internet, it is the address of a standard resource on the Internet.2. URL format
2.1 Standard format
Protocol type:[// Server address[:port number]][/resource level UNIX file path]File name? Query2.2 Full format
Protocol type:[//[Access resources Required credential information@]server address[:port number]][/resource level UNIX file path]file name?querywhere [access credential information@;:port number;?query;#fragment ID] are all options Fill in the items.
3. URL syntax rules
For example, the URL http://segmentfault.com/html/index.asp must comply with the following Syntax rules: scheme: //host.domain:port/path/filename3.1 Description
(1) scheme - Define Internet services type. The most common type is http (2) host - defines the domain host (the default host for http is www) (3) domain - defines the Internet domain name, such as w3school.com.cn(4):port - defines the port number on the host (the default port number for http is 80) (5) path - defines the path on the server (if omitted, the document must be located in the root directory of the website). (6)filename - defines the name of the document/resource3.2 URL Schemes
The following are some of the most popular schemes:
Access | for... | |
---|---|---|
Hypertext Transfer Protocol | Ordinary web pages starting with http://. No encryption. | |
Secure Hypertext Transfer Protocol | Secure web page. Encrypt all information exchanged. | |
File Transfer Protocol | is used to download | files or upload them to a website. |
A file on your computer. |
The above is the detailed content of The use of url, href and src in JS. For more information, please follow other related articles on the PHP Chinese website!