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 8852655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:27:22+00:00 2026-06-14T13:27:22+00:00

I am developing an app that embeds users’ Facebook profile picture( http://graph.facebook.com/(fb id)/picture) inside

  • 0

I am developing an app that embeds users’ Facebook profile picture(http://graph.facebook.com/(fb id)/picture) inside an img tag. And it works…for the most part. However I will occasionally get 400 errors when I request the profile picture(see this)

Is there any way I can detect these 400 errors with Javascript/JQuery? Right now they are being displayed as a broken image….

  • 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-06-14T13:27:23+00:00Added an answer on June 14, 2026 at 1:27 pm

    This is pretty simple using the onerror event.

    We can simply create a new image in JavaScript and attach two events to it – onload and onerror. Then setting the image src will make the browser download the image, firing the onload event if it is a true image, or onerror if not.

    var img = new Image();
    
    // This URL will return an image an fire `onload`
    img.src = 'http://placekitten.com/300/300';
    
    // Replace the line above with this one to load a fake/unavailable image, which will fire the `onerror` event.
    // img.src = 'http://mybrokenurl';
    
    img.onload = function() {
        document.body.appendChild(img);
    }
    
    img.onerror = function() {
        alert('Error loading image');
    }​
    

    Demo: http://jsfiddle.net/amustill/vSJ4F/

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

Sidebar

Related Questions

I am developing an app that will use the profile picture of user. I
im developing an app that allows users to take a picture and then it
I am currently developing an app that reads out SMS/Emails while driving. Many users
I'm developing an app that will make extensive HTTP requests. I know for a
I am developing an app that will allow users to capture images of secure
I'm developing an app that receive contente (URI) and I'm testing it with IE10
I am developing an app that needs the chat functionality, presenting messages sent and
(I am developing an app that presents chat messages in a table. But, this
I am developing an app that has java files and php files. The java
i'm developing an app that has a jtable and user could start a download.

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.