Failed to load resource: net::ERR_FILE_NOT_FOUND. Even though the file is present

I cloned crocs home page. But when i open the index file all images are not loaded. Console saying "Failed to load resource: net::ERR_FILE_NOT_FOUND". But on live preview it works fine. What is the reason for this behaviour ? Help me out.
11 Replies
Jochem
Jochem2mo ago
99% of the time, a relative vs absolute path issue but it's impossible to tell without more information
syedmubarish
syedmubarishOP2mo ago
No description
No description
syedmubarish
syedmubarishOP2mo ago
is it because of webp file extension?
Jochem
Jochem2mo ago
no you'll have to share your code
syedmubarish
syedmubarishOP2mo ago
u mean complete code? i can give github repo link
Jochem
Jochem2mo ago
probably just the img tag of a broken image is enough that works too
syedmubarish
syedmubarishOP2mo ago
GitHub
GitHub - syedmubarish/Crocs-static-clone: crocs homepage cloned. No...
crocs homepage cloned. Not responsive. Contribute to syedmubarish/Crocs-static-clone development by creating an account on GitHub.
syedmubarish
syedmubarishOP2mo ago
is this good?
Jochem
Jochem2mo ago
where are you hosting it? If I look at your HTML, it has absolute URLs:
<img src="/assets/logo-crocs.svg" alt="logo-crocs" height="60px">
<img src="/assets/logo-crocs.svg" alt="logo-crocs" height="60px">
That / at the start means that the browser will look for your SVG at https://domain.tld/assets/, regardless of where your site is. If you host your site at https://domain.tld/crocs-static-clone/, then the browser will still look for your images in https://domain.tld/assets/ instead of https://domain.tld/crocs-static-clone/assets/ like it should it'll likely be fixed by just removing the starting /, so just have <img src="assets/logo-crocs.svg" alt="logo-crocs" height="60px"> I'd recommend reading up on how paths work in HTML. It's not super complicated, but not understanding them properly can cause huge problems
syedmubarish
syedmubarishOP2mo ago
Thank you sir. Thank you for sparing some time for me
Jochem
Jochem2mo ago
glad to help!

Did you find this page helpful?