How do I capture the HTTP code of an iframe?
问题 I would like to catch the HTTP code of an iframe. Depending on the HTTP code the iframe must continue/stop loading. Is there any way to do this, using Jquery etc? Or should I use Curl first to check the HTTP code and then load the iframe? Thanks in advance. 回答1: You can do this by using XmlHttRequest to load your "iframe" : var httpRequest = new XMLHttpRequest(); httpRequest.onreadystatechange = function() { if (httpRequest.readyState === 4) { if (httpRequest.status === 200) { // success