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
99% of the time, a relative vs absolute path issue
but it's impossible to tell without more information
is it because of webp file extension?
no
you'll have to share your code
u mean complete code?
i can give github repo link
probably just the img tag of a broken image is enough
that works too
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.
is this good?
where are you hosting it? If I look at your HTML, it has absolute URLs:
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 problemsThank you sir. Thank you for sparing some time for me
glad to help!