228

There is a bunch of images in a web page.

Other browsers do download them correctly, but Chrome doesn't.

In the developer's console, it shows the following message for each image:

Failed to load resource

As mentioned before, problem appears only in Chrome.

What is it?

Sold Out
  • 1,321
  • 14
  • 34
AntonAL
  • 16,692
  • 21
  • 80
  • 114
  • 1
    Can you show some HTML? We need more information to help you with your issue. – Andre Dec 25 '10 at 15:44
  • 3
    The reason I set a bounty for this question is that it occurs from time to time and is not related to images only. The site that I am working on works fine in firefox and fails occasionally in chrome. –  Dec 25 '10 at 15:51
  • 2
    How you have solved the problem? – maks Sep 22 '13 at 20:40
  • Check if Google Chrome extensions are blocking requests. – Samuel Edson Jan 16 '14 at 17:56
  • possible duplicate of [Bizarre error in Chrome --> Failed to load resource: net::ERR\_CACHE\_MISS](http://stackoverflow.com/questions/26408931/bizarre-error-in-chrome-failed-to-load-resource-neterr-cache-miss) –  Oct 29 '14 at 10:47
  • Can anyone find a solution? – Viraj Mohite Mar 15 '22 at 10:30

14 Answers14

310

I recently ran into this problem and discovered that it was caused by the "Adblock" extension (my best guess is that it's because I had the words "banner" and "ad" in the filename).

As a quick test to see if that's your problem, start Chrome in incognito mode with extensions disabled (ctrl+shift+n) and see if your page works now. Note that by default all extensions will be already disabled in incognito mode unless you've specifically set them to run (via chrome://extensions).

Kabir Sarin
  • 18,092
  • 10
  • 50
  • 41
  • 3
    Yes that's it! Mine had "Popup" in the name and this was causing the issue. – Janik Zikovsky Sep 28 '12 at 22:54
  • Thankyou. localhost site was fine, once on a live url the issue appeared, had me thinking.. – Sam Doidge Mar 13 '13 at 07:43
  • 1
    Thanks! I spent over 30mins trying to figure out why my code didn't work in Chrome. – heyomi May 23 '13 at 01:37
  • Thanks, I appeared to be having a similar problem (where certain images would display on some computers but not others - xbrowser in at least a few cases). I never isolated the precise problem but removing tokens "ad" and "banner" from url strings seems to have done the trick. Perhaps in my case there is some software which edits content from urls matching certain criteria before it even gets to the browser? In any case, the tip to watch out for these words in the filename was very helpful. – amomin Jun 05 '13 at 14:58
  • 2
    Thanks for saving me. I had 'Ad' word in my url. When i removed, it worked. But, is there any workaround for this? I mean, I don't want to change my url. – Amit Apr 09 '15 at 16:53
  • The extension is blocking anything with the word "Ad" in it. Either change the url, or stop using the extension. If there was a workaround, Adblock wouldn't be very useful, now would it? ;) – Kabir Sarin Apr 13 '15 at 15:53
  • Yes! Its being block. However, I'm serving Disqus comments in my web application. Is there a workaround to unblock these resources for my users? – moeabdol Aug 17 '15 at 22:47
  • 2
    I have this issue too, but I doesn't have any extension installed and running the newest version, what todo? – TheCrazyProfessor Oct 03 '18 at 12:45
39

Check the network tab to see if Chrome failed to download any resource file.

ismail
  • 46,010
  • 9
  • 86
  • 95
  • 3
    @Cartman I apologize for my ignorance. What do you mean by Network tab? –  Dec 25 '10 at 15:52
  • 1
    Right click any element on the page, select "Inspect Element" it will open the "Inspector", Inspector has lots of tabs for debugging the web page, one of them is the "Network" tab, click it, reload the page and check for any network error. – ismail Dec 25 '10 at 15:54
  • @Cartman - Thanks, I use the inspector a lot and cant find the network tab. I have elements, resources, scripts, timeline profile, storage, audits and console. I will google around and try to understand why I do not have a network tab. –  Dec 25 '10 at 16:06
  • 1
    I am using Chromium 10.0.xx.xx , make sure you use a recent snapshot. – ismail Dec 25 '10 at 16:17
  • @Cartman - Thanks for the chromium tip - wasn't aware of this project. Installed version 10.0.621.0 (70119). Have recreated the problem. The message in the Network tab is 16 requests 0B transfered. The console is stating: GET http://localhost:51707/Content/Theme.css undefined (undefined) Even thought 20 seconds before it fetched it without any problem. –  Dec 25 '10 at 16:58
  • Looks like there is a problem with downloading Theme.css, does Apache show anything useful in its access/error log? – ismail Dec 25 '10 at 17:00
  • @Cartman - Please note that this does not only happen with Theme.css it happens randomly on different files. The more I am looking into the chrome forums I am getting the feeling it is a bug in Chrome/Chromium. –  Dec 25 '10 at 17:03
  • @Cartman - Update - I am using a Lenovo laptop - There seems to be a problem with the wireless network drivers - as a result, Every few seconds the network disconnects and reconnects again. If the web page was in the middle of downloading files to build the page, Chrome looses the files and does not continue to download them. This is not the case with IE and Firefrox. I have opened an issue at the chromium issue site (68109). Thanks for your help with introducing Chromium to me - For that I will award you the bounty. –  Dec 28 '10 at 19:10
  • I just got net::ERR_INVALID_CHUNKED_ENCODING Which is logged as Chrome bug https://bugs.chromium.org/p/chromium/issues/detail?id=39206 – Adrian P. Aug 17 '16 at 13:10
21

In case it helps anyone, I had this exact same problem and discovered that it was caused by the "Do Not Track Plus" Chrome Extension (version 2.0.8). When I disabled that extension, the image loaded without error.

nuri
  • 441
  • 5
  • 6
  • Thanks for the tip, I was in the same situation and pulling my hair over what was the reason – jasalguero Apr 07 '12 at 15:58
  • That what happened to me, the Chrome didn't load CSS files because of AdBlock extension, when I cancel the extension all worked fine. – Chani Poz Jan 31 '14 at 02:19
20

There is also the option of turning off the cache for network resources. This might be best for developing environments.

  1. Right-click chrome
  2. Go to 'inspect element'
  3. Look for the 'network' tab somewhere at the top. Click it.
  4. Check the 'disable cache' checkbox.
john k
  • 6,268
  • 4
  • 55
  • 59
  • could u check this once http://stackoverflow.com/questions/42693371/developer-tools-does-not-loads-resources @john ktejik – Yokesh Varadhan Mar 09 '17 at 12:12
  • This did it for me. – JayJay123 Mar 26 '17 at 06:03
  • With this resolving a particular issue for me. It does so only for the developers. How do I take this knowledge and release it into production so that the user is not experiencing this issue anymore. Does this just mean the onclick that's giving me this error should be clearing the cache each time or something along those lines? – Sharkboots Jan 28 '20 at 17:34
  • You saved me a lot of time. I tried your 1,2 and 4 nut not 4. Now I checked the 'disable cache' checkbox, there is a lot of differences. – Hello Mar 18 '20 at 18:47
  • Thanks this solved for me on failed uploads of audio files that were below the file size limit. Every upload for had failed until I disabled this cache setting. – cogdog Jul 05 '21 at 22:42
  • Actually this only worked once, and failed twice again today. My solution was switching to Firefox. Upload worked on first try. – cogdog Jul 12 '21 at 14:19
8

Kabir's solution is correct. My image URL was

/images/ads/homepage/small-banners01.png, 

and this was tripping up AdBlock. This wasn't a cross-domain issue for me, and it failed on both localhost and on the web.

I was using Chrome's network tab to debug and finding very confusing results for these specific images that failed to load. The first request would return no response (Status "(pending)"). Later down the line, there was a second request that listed the original URL and then "Redirect" as the Initiator. The redirect request headers were all for this identical short line of base64-encoded data, and each returned no response, although the status was "Successful":

GET      data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg== HTTP/1.1

Later I noticed that these inline styles were added to all the image elements:

    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;

Finally, I did not receive any "failed to load resource" messages in the console, but rather this:

Port error: Could not establish connection. Receiving end does not exist.

If any of these things is happening to you, it probably has something to do with AdBlock. Turn it off and/or rename your image files.

Also, because of the inline CSS created by AdBlock, the layout of my promotions slider was being thrown off. While I was able to fix the layout issues with CSS before finding Kabir's solution, the CSS was somewhat unnecessary and affected the flexibility of the slider to handle images of multiple sizes.

I guess the lesson is: Be careful what you name your images. These images weren't malicious or annoying as much as they were alerting visitors to current promotions and specials in an unobtrusive way.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
jmorganmartin
  • 323
  • 2
  • 6
7

If the images are generated via an ASP Response.Write(), make sure you don't call Response.Close();. Chrome doesn't like it.

isherwood
  • 58,414
  • 16
  • 114
  • 157
bcolin
  • 438
  • 3
  • 6
4

I was getting this error, only in Chrome (last version 24.0.1312.57 m), and only if the image was larger than the html img. I was using a php script to output the image like this:

header('Content-Length: '.strlen($data));
header("Content-type: image/{$ext}");
echo base64_decode($data);

I resolved it adding 1 to the lenght of the image:

header('Content-Length: '.strlen($data) + 1);
header("Content-type: image/{$ext}");
echo base64_decode($data);

Appears that Chrome dont expect the correct number of bytes.

Tested with sucess in Chrome and IE 9. Hope this help.

marcostrama
  • 161
  • 7
  • Same here.. In my case it was Service Stack that does add Content-Length when serializing Objects but not a Stream or Byte Array. – shex Nov 12 '13 at 17:07
  • Suddenly the "+1" in the content length begins to cause "Invalid Chunk Header" in my communication with Tomcat (i use php java bridge to comunicate apache with tomcat). I removed this "+1" and it became to work normally in Chrome. The error with chunk disapeared too. Strange issue... I dont figure out what happened. – marcostrama Jun 25 '15 at 04:14
4

Facts:

Community
  • 1
  • 1
3

There is a temporary work around in Reenable (temporary) showModalDialog support in Chrome (for Windows) 37+.

Basically, create a new string in the registry at

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\EnableDeprecatedWebPlatformFeatures

Under the EnableDeprecatedWebPlatformFeatures key, create a string value with the name 1 and a value of ShowModalDialog_EffectiveUntil20150430. To verify that the policy is enabled, visit chrome://policy URL.

Devid Farinelli
  • 7,514
  • 9
  • 42
  • 73
Merlin051
  • 161
  • 2
  • 9
3

FYI - I had this issue as well and it turned out that my html listed the .jpg file with a .JPG in caps, but the file itself was lowercase .jpg. That rendered fine locally and using Codekit, but when it was pushed to the web it wouldn't load. Simply changing the file names to have a lowercase .jpg extension to match the html did the trick.

Tony Tambe
  • 573
  • 1
  • 10
  • 30
2

In Chrome (Canary) I unchecked "Appspector" extension. That cleared the error. enter image description here

1

I updated my Chrome browser to the latest version and the issue was fixed.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sergiu
  • 1,397
  • 1
  • 18
  • 33
1

It is due to ad-blocker.When project files names contains words like 'ad' then ad-blockers also block theses files to load.

Best solution is that never save any files with these name keys.

GHULAM NABI
  • 498
  • 5
  • 15
0

Removing the / from the path helped me to solve this problem.

See more at: Failed to load resource: net::ERR_FILE_NOT_FOUND loading json.js

Ether Man
  • 41
  • 6