Sigh, we\'re back to this. I can easily enough use CORS on any decent enough browser to directly upload files to my AWS S3 bucket. But (it was coming), with IE I have to fall ba
AS for the "postMessage" scenario, maybe the iframe should contain a simple javascript
[edit] for iframes taken over by an errormessage
IFRAME script
window.document.onload = function(e){
window.parent.postMessage(document, '*'); //replace '*' with your parent if possible
}
// just to get the proper document for the parent to target me
window.addEventListener('message',function(e) {
if (e.domain == 'example.com') { // the domain of your parent frame
if (e.data == "Salute") {
window.parent.postMessage("I'm here", '*'); //replace '*' with your parent too
}
}
});
Now parent knows the iFrame perfectly well and can track it's status (depending on if it's answering a simple postMessage)
PARENT script
var iFrameTarget;
var iFrameTakenOver = false;
var timer;
window.addEventListener('message',function(e) {
if (e.domain == 'example.com') { // the domain of your iframe
if (e.data) { // e.data contains the iframe document
if(typeof(e.data) =='object')
iFrameTarget = e.source;
elseif(e.data == "I'm here")
{
iFrameTakenOver = false;
}
timer =setInterval(call_iFrame(),5000); // check iFrame presence in 5 seconds
}
}
});
function call_iFrame() {
iFrameTarget.postMessage('Salute');
iFrameTakenOver = true;
}
IF iframe is not responding with it's "code" iFrameTakenOver will be permanently set to false checking that will verify if an error has occured or not.