Skip to main content

Zian's Blog

  • Programming
    • Spring Boot
    • Javascript
    • ASP.NET
  • New Technology
  • Error solution
  • Uncategorized
  • About Me
  • Home

Category: Error solution

Javascript image load error handling

February 14, 2018February 28, 2018 ziankabir 2 Comments

There is multiple way to solve the error if image/images fails to load. The easiest solution is to show to a show a default error image. A line of Javascript can easily handle the error!

Inside you image tag just write the following line of code:

onerror="if (this.src != 'source-of-your-error-image.jpg') this.src = 'source-of-your-error-image.jpg';"

That’s all!

Recent Posts

  • Spring Boot – HATEOAS for RESTful Services
  • Writing Complex Queries Using LINQ
  • Eid Mubarak
  • Difference Between Coding & Programming?
  • WooCommerce: Add a New Tab in My Account Page

Archives

  • November 2022
  • November 2021
  • May 2021
  • March 2021
  • February 2021
  • December 2020
  • September 2020
  • June 2020
  • April 2020
  • February 2020
  • January 2020
  • November 2019
  • October 2019
  • June 2019
  • February 2019
  • September 2018
  • July 2018
  • April 2018
  • February 2018
  • July 2017

Categories

  • ASP.NET
  • Error solution
  • Javascript
  • New Technology
  • Programming
  • Softwares
  • Spring Boot
  • Tech News
  • Uncategorized

Follow me

  • Facebook
  • Google Plus
  • Twitter
  • Linkedin
  • Mail
  • Facebook
  • Google Plus
  • Twitter
  • Linkedin
  • Mail
sparkling Theme by Colorlib Powered by WordPress