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
Jochem3d ago
99% of the time, a relative vs absolute path issue but it's impossible to tell without more information
syedmubarish
syedmubarishOP3d ago
No description
No description
syedmubarish
syedmubarishOP3d ago
is it because of webp file extension?
Jochem
Jochem3d ago
no you'll have to share your code
syedmubarish
syedmubarishOP3d ago
u mean complete code? i can give github repo link
Jochem
Jochem3d ago
probably just the img tag of a broken image is enough that works too
syedmubarish
syedmubarishOP3d 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
syedmubarishOP3d ago
is this good?
Jochem
Jochem3d 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
syedmubarishOP3d ago
Thank you sir. Thank you for sparing some time for me
Jochem
Jochem3d ago
glad to help!
Want results from more Discord servers?
Add your server