how to deal with broken link image?

allan's Avatar


18 Aug, 2014 09:53 AM

I am displaying a group of say 10 images but the middle one has a problem so will not load.
In tabs a broken link image is displayed, but if clicked, slider shows loading symbol only

What is the best way to deal with this image so that it is not shown at all?

  1. Support Staff 1 Posted by Dmitry Semenov on 18 Aug, 2014 02:10 PM

    Dmitry Semenov's Avatar


    Well, the best way is to check for URL on server side. But you may hook in rsAfterContentSet event, something like this:

    var s = $('.royalSlider').data('royalSlider');
    s.ev.on('rsAfterContentSet', function(e, slideObject) {
        var img = new Image();
        img.onerror = function() {  /* handle error */  };
        img.src = slideObject.image;


  2. 2 Posted by Vicente Martins on 26 Jun, 2019 06:19 PM

    Vicente Martins's Avatar

    I know this topic is very old, but I'm doing a change on a project using RoyalSlider jQuery version 9.5.0 and I just tested the suggestion above.
    Looks like rsAfterContentSet is not executed when the image is not loaded...
    Any suggestion?
    You can check my scenario here:
    Just slide the images until slide 5 or 6.

  3. Support Staff 3 Posted by Dmitry Semenov on 26 Jun, 2019 10:12 PM

    Dmitry Semenov's Avatar

    You'll need to load and append the image manually. Remove rsImg class to prevent slider from loading the image. Then within rsAfterContentSet event parse current slide DOM element to retrieve image URL and load it with your own logic.

  4. 4 Posted by Vicente Martins on 27 Jun, 2019 02:10 PM

    Vicente Martins's Avatar

    Hi Dmitry,
    Thank you for the answer and especially for answering so fast.
    Here is what I ended up doing:

    slider.ev.on('rsAfterSlideChange', function(event) {
        if (slider.currSlide.isLoading && slider.currSlide.iH == 0 && slider.currSlide.iW == 0) {
    for successful loads iW and iH are not set until isLoading is false. so, if isLoading is true and iW and iH are present I'm assuming an error happened.
    so far it is working on test scenarios I ran!
    thank you for the assistance.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac