How to rightly detect iframe was loaded with response 204 No Content?
问题 For more clarity I made it simple (so let's presume that iframe.attr() will be called after previous load was fully completed): var iframe = $("iframe"); var counter = 0; var trackLoads = function(){ console.log("I was loaded:" + counter); counter += 1; }; iframe.load(trackLoads); iframe.attr("src","http://stackoverflow.com/"); iframe.attr("src","http://localhost:9081/mobile/api/content/badPath"); //returns 204 No Content iframe.attr("src","http://stackoverflow.com/"); Console log looks like