最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Server failed to load resource (404) what do I do? - Stack Overflow

programmeradmin3浏览0评论

I can't solve my server problem; could you help on this?

HTML:

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <img src="" id="rainbow">

JavaScript:

<script>
        console.log('im trying to fetch a c# logo')
        fetch('download.png').then(response => {
            console.log(response)
        })
    </script>

Error message:

im trying to fetch a c# logo
fetch.html:44 Live reload enabled.
download.png:1 Failed to load resource: the server responded with a status of 404 (Not Found)

I can't solve my server problem; could you help on this?

HTML:

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <img src="" id="rainbow">

JavaScript:

<script>
        console.log('im trying to fetch a c# logo')
        fetch('download.png').then(response => {
            console.log(response)
        })
    </script>

Error message:

im trying to fetch a c# logo
fetch.html:44 Live reload enabled.
download.png:1 Failed to load resource: the server responded with a status of 404 (Not Found)

Share Improve this question edited Oct 21, 2023 at 14:54 Brian Tompsett - 汤莱恩 5,89372 gold badges61 silver badges133 bronze badges asked Mar 24, 2021 at 10:43 BILALBILAL 31 gold badge2 silver badges7 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

The 404 error belongs to the 4xx error category and indicates an error on the client's side.
A 404 error occurs when a file cannot be found.

How can you fix this?

  1. Check if the image is in the same path as your script / HTML file.
  2. Check the name and extension of the image / file. Has a typing error crept in?
发布评论

评论列表(0)

  1. 暂无评论