I would like to get the url of the iframe when the page fails to load. Everytime I try I keep getting the original url of the iframe not the url it tried to access but failed on. How would I achieve this ?
Here is my current script:
var url1 = document.getElementById("ifrim").src;
Only thing I can suggest :
iframe = document.getElementById("theIframe");
iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
url = iframeDoc.location || iframeDoc.URL;
url will equal the URL of the iframe
Also... if you get an error 404 page, you can test for a failed page load by
loadedOK = iframeDoc.body.innerHTML.indexOf("Error 404")>-1?false:true;
where loadedOK is true, you have a loaded page otherwise false is a failed load.