The problem with relative links in windows 7, how to solve this problem?

Hello! Recently, the windows 7 computer has detected a problem: there is a folder inside which html file and another folder with images car.jpg. In an html document inserted image, img src="car.jpg" when you open this file in chrome the image does not appear, but when you specify the full file path img src="C:\Users\...\car.jpg everything works. It all started recently, before worked with relative paths. Maybe the problem is in the computer?
June 27th 19 at 15:07
3 answers
June 27th 19 at 15:09
  • folder
    • img
      • car.jpg

    • index.html



As you described, you have such a body, if so, then img src="car.jpg" you could not work, and if could not, then you're not telling us something. You must have img src="img/car.jpg" now that's the right relative path.

If everything worked before, then you pictures was in a folder with the html file, you once put it in a folder and forgotten.
I had a folder called "sait". Inside was: the html file "index" and folder "pictures" with picture "car.jpg". In html, the image has been specified like img src="car.jpg". A couple of days ago when opening index in chrome the picture, but after you restore windows by using the control point, when opening the file picture is not there. - roy commented on June 27th 19 at 15:12
: it does not happen - Elmer.Upt commented on June 27th 19 at 15:15
The author or the drug addict or memento, such a structure could not work as You say.
So it's definitely not the computer, but rather in the brain - aniya_Yost commented on June 27th 19 at 15:18
June 27th 19 at 15:11
Problems and that the link is not specified the folder in which the attached figure.
Img src="car.jpg" the drawing has to be in the same folder as the html file.
But why then earlier all worked and without the directory? - roy commented on June 27th 19 at 15:14
the folder is named the same as the html file? - Elmer.Upt commented on June 27th 19 at 15:17
No. - aniya_Yost commented on June 27th 19 at 15:20
: perhaps before the name was the same and therefore everything worked. note how the browser saves any page in the HTML separately .html file and a separate folder with images and other resources saved pages, and folder has the same name as the saved .html - roy commented on June 27th 19 at 15:23
June 27th 19 at 15:13
and it is right that links are not stored with the full path, but relative.
when you transfer the html And related files to any other place will not need to change something in the HTML.
to further no problems, you just need all the associated files or zipout, or to put in your individual folder, not to confused "components" page. It will be possible to store the page anywhere, even on the computer, though on the flash drive, even on the cloud.

Find more questions by tags ComputersHTMLWindows