Home  >  Article  >  Web Front-end  >  What request is sent by href and src?

What request is sent by href and src?

DDD
DDDOriginal
2023-08-17 14:20:351504browse

Get request sent by href and src. Detailed description: 1. The href attribute is used to specify the target resource of the link. When referencing an external style sheet, it will send a GET request to obtain the CSS file. When referencing the document, it will send a GET request to obtain the specified HTML file. When referencing an image, it will send a GET request. To obtain the specified image file; 2. The src attribute is used to specify the URL of the embedded resource. When referencing the image, it will send a GET request to obtain the specified image file. When referencing the audio, it will send a GET request to obtain the specified audio file, etc. .

What request is sent by href and src?

#The operating environment of this article: Windows 10 system, Dell G3 computer.

href and src are attributes used in HTML to reference external resources. They can send different types of requests.

href attribute:

href is used to specify the target resource of the link, usually used to reference external style sheets (CSS files), documents (HTML files), images (picture files) and other media Files (audio, video, etc.).

When href refers to an external style sheet, it sends a GET request to obtain the CSS file in order to style the document.

For example:

<link rel="stylesheet" href="style.css">

This link will send a GET request to obtain an external CSS file named style.css.

When href refers to a document, it sends a GET request to obtain the specified HTML file.

For example:

<a href="about.html">About</a>

This link will send a GET request to obtain the HTML file named about.html.

When href refers to an image, it sends a GET request to obtain the specified image file.

For example:

<img src="image.jpg" alt="Image">

This link will send a GET request to obtain an image file named image.jpg.

src attribute:

src is used to specify the URL of embedded resources (such as images, audio, video), usually used to embed these resources in HTML documents.

When src refers to an image, it sends a GET request to obtain the specified image file.

For example:

<img src="image.jpg" alt="Image">

This link will send a GET request to obtain an image file named image.jpg.

When src refers to audio, it sends a GET request to obtain the specified audio file.

For example:

<audio src="audio.mp3" controls></audio>

This link will send a GET request to obtain the audio file named audio.mp3.

When src refers to a video, it sends a GET request to obtain the specified video file.

For example:

<video src="video.mp4" controls></video>

This link will send a GET request to obtain the video file named video.mp4.

Summary:

The href attribute is used to specify the target resource of the link. You can send a GET request to obtain external style sheets, documents, images and other files. The src attribute is used to specify the URL of the embedded resource, and you can send a GET request to obtain images, audio, video and other files.

The above is the detailed content of What request is sent by href and src?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn