jQuery.error() is not working for iframe.

后端 未结 2 1920
清酒与你
清酒与你 2021-01-21 06:18

I\'m trying to use jquery to detect whether an iframe fails to load or the page doesn\'t exist, but the code below isn\'t working:

$(\'#frame\').e         


        
2条回答
  •  盖世英雄少女心
    2021-01-21 06:47

    One of the comments on the documentation says:

    Using .error() on an iframe never seems to trigger (even though .load() will trigger on a successful iframe load).

    This event does not appear to be designed to work in this use case.

    The answers to this question explain how to do it.

提交回复
热议问题