Img labels cannot display images using absolute paths. img absolute paths

Source: Internet
Author: User

Img labels cannot display images using absolute paths. img absolute paths

Note: The disk path slash of the image is "\", and the network path of the image is.

If this image is a server image or network image, we must use the network path in the Img label. Only the network path can send requests through the browser, download the image to the temporary path of your browser to display it on the page;

If the image is displayed locally, you can directly use the disk path of the image.

 

The following is an image of a project under my account.The disk path is:

D: \ SourceCode \ MCSFramework \ 02. Develop \ MobileWebApp \ Seagull2 \ WebApi \ Seagull2.YuanXin. WebApi \ Resources \ Pic \ 2016 \ 12 \ .jpg

In the projectThe network path is:

Http: // localhost: 10086/yuanxin/Resources/Pic/2016/12/ ..jpg

:

 

 

Cause analysis:

This is because when we enter the disk path in the img tag, we actually sent an http request. This is a failed request and there will be no response information.

Request address: file: // + disk path? Which of the following is a normal request !!!

If the image is originally located locally, the browser can still find the image even if we don't get the response image. However, if the image is originally on another server, you cannot display the image.

For example:

 

 

Note: Here is my experience. If you have any mistakes, please criticize and correct them...

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.