0

I have a website with images of people. Sometimes the server with all of the images goes down and my website shows broken image links. I wanted to see if there is anyway on a webpage to have the following logic where you src one picture but if it doesn't load properly then default to another picture as a backup?

I am fine if it requires js or jquery, etc . .

leora
  • 188,729
  • 360
  • 878
  • 1,366
  • 2
    I think that you want the solution in this question: http://stackoverflow.com/questions/92720/jquery-javascript-to-replace-broken-images – Prestaul Apr 14 '12 at 17:28
  • Are you serving up images in a way that the asp.net-mvc tag is relevant, such as `return File(...)`? – JustinStolle Apr 14 '12 at 22:31

1 Answers1

3

I think you can do it with css. Just do something like this on an image class. And set it to the html tag

.myimage{
    background: url("images/default.png");

}

Or check this out.

Community
  • 1
  • 1
Preben Huybrechts
  • 5,853
  • 2
  • 27
  • 63