简体   繁体   中英

Insert image into HTML page using absolute path

I'm given a task to insert an image to an index2 HTML page using absolute path, however, I'm getting this error " Failed to load resource: net::ERR_FILE_NOT_FOUND." if I use this path "images/baby-01.jpg", but If I use the relative path given below, I'm able to load the image.

<img src="/Users/gill/Downloads/Lab1/lab1-part2-images/abs-path/images/baby-01.jpg" alt="baby 01"/>" 

Image path

/Users/gill/Downloads/Lab1/lab1-part2-images/abs-path/images/baby-01.jpg

The path of the page I'm trying to insert the image into.

/Users/gill/Downloads/Lab1/lab1-part2-images/abs-path/local news/index2.html

The absolute path has to be the absolute URL path and not the absolute filesystem path.

The root of the path is the directory the web server is configured to treat as a root, not the file system that the web server is installed on (otherwise, anyone could download any file from any computer running a web server).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM