EDIT:
Fixed as follows, simply hide the iframe by setting height and width to zero:
<iframe frameborder="0" id="frm" height="0" width="0"></iframe>
var frmurl ='http://www.bbc.co.uk';
jQuery(function($){
$('#frm').attr('src', frmurl);
var doc = $('#frm')[0].contentDocument;
$(doc.body).html('This text should replace the BBC website');
});
My website relies on a third party system to update a record in a database and display a confirmation message. Access to the third party system is via an iFrame. I would like to replace the confirmation message with one of my own.
I use jQuery and I have the iFrame working correctly except that my replacement text is displayed very briefly before the confirmation message generated by the third party system overwrites it. You can see an example at this jsFiddle.
How can I ensure that my own text isn't overwritten? I think it has to do with the sequence of events in which the page is generated?
<iframe frameborder="0" id="frm" scrolling="no" width="100%"></iframe>
var frmurl ='http://www.bbc.co.uk';
jQuery(function($){
$('#frm').attr('src', frmurl);
var doc = $('#frm')[0].contentDocument;
$(doc.body).html('This text should replace the BBC website');
});