Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6103019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:40:51+00:00 2026-05-23T13:40:51+00:00

If an image doesn’t exist, or somehow an image just doesn’t load, is there

  • 0

If an image doesn’t exist, or somehow an image just doesn’t load, is there a way to make it so this message doesn’t show up in the web inspector?

Failed to load resource: the server responded with a status of 403 (Forbidden)

I have tried these:

<img src="/path.png" onerror="this.src = '/missing.png'; this.onerror = ''; return true;"/>
<img src="/path.png" onerror="this.src = '/missing.png'; this.onerror = ''; return false;"/>

And I’ve tried it in jQuery:

$(document).ready(function() { 
  $("img").error(function(event) {
    $(this).attr("src", "/missing.png");
    return false;
  }
});

That message gets output in red before any of these event handlers get access to it, is there not a way to prevent this message from showing up?

Ideally, I would be able to do this:

$("img").live("error", function() { $(this).attr("src", "/missing.png"); });

so I don’t have to:

  1. Write inline javascript like <img onerror='x'/>
  2. and it would work on dynamically loaded images.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:40:52+00:00Added an answer on May 23, 2026 at 1:40 pm

    Unfortunately you would need to check for the existence of the image prior to adding the <img> to the DOM. This check would have to occur server-side as far as I know; even attempting to do this with JQuery/AJAX will still result in a 404 or 403 error appearing in the console.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a game with Qt, but i can't load an image.
when I'm trying to getimagesize($img) and the image doesn't exist, I get an error.
Hi please take a look at this code: // if the image url doesn't
I have a logo image with a background gradient. However, this image doesn't fill
How can I make this work? int resId = getResources().getIdentifier(image + passedVar, drawable, com.fnesse.beachguide);
I resized an image using Java2D Graphics class. But it doesn't look right. BufferedImage
The Pharo dev image ships, by default, with a browser that doesn't seem to
I am using those codes for rotation transforming an image, but it doesn't work.
why when i write document.getElementByClass('home1').setAttribute('style', 'background-image:url(img/red_menu.PNG);'); it doesn't work? i have the element with
I've found a great datepicker on EveryBlock's web site: http://ui-patterns.com/userset/553/image/2955#focus Does anybody know which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.