+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Returning specific image instead of 404

Returning specific image instead of 404

4 posts, 0 answered
  1. Glen
    Glen avatar
    3 posts
    Registered:
    28 May 2014
    17 Jul 2014
    Link to this post

    We want to be able return a specific image that says "image not found" (rather than returning a 404 to the browser) when an IMG tag points to an non-existing file at our images library at /images/default-source/ for example. Is that possible to do through configuration, or customizing a provider?

  2. Eric
    Eric avatar
    147 posts
    Registered:
    12 Nov 2007
    18 Jul 2014 in reply to Glen
    Link to this post

    Via Sitefinity, I doubt it. Via Javascript, you could do something like

    <img src="xyz.gif" onError="this.onerror=null; this.src='notfound.gif';" />

    or

    $('img').error(function () {
      $(this).unbind('error').attr('src', 'notfound.gif');
    });

  3. Vassil Vassilev
     Vassil Vassilev avatar
    308 posts
    Registered:
    21 Jan 2015
    22 Jul 2014
    Link to this post
    Hello Eric,

    You can find various samples here: jQuery/Javascript to replace broken images

    Hope this helps.

    Regards,
    Vassil Vassilev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  4. Glen
    Glen avatar
    3 posts
    Registered:
    28 May 2014
    29 Jul 2014
    Link to this post

    Excellent suggestions,didn't think about handling it in the client side. Thanks!

4 posts, 0 answered