I am copying the content from one frame to the other. My codes are working in Mozilla Firefox but it is not working in Google Chrome. Can someone tell me where I went wrong?
This part is not executing in Google chrome :
$('#frame1').load(function(e){
});
Below is my code block:
$headContent = $("#mainframe").contents().find("head").html();
$bodyContent = $("#mainframe").contents().find("body").html();
$('<iframe />');
$('<iframe />',{ id: 'frame1',
class:'myframe',
height: 600,
width: "100%"
}).appendTo(uxcontainerPath);
$('#frame1').load(function(e){
console.log("Executed #frame1 load"); //this console line is not executed in chrome
$(this).contents().find('html').append('<head></head>');
$(this).contents().find('head').append($headContent);
$(this).contents().find('body').append($bodyContent);
});
It appears as if load-event fires too quick, add the load-listener before you inject the iframe into the DOM:
$('<iframe />',{ id: 'frame1',
class:'myframe',
height: 600,
width: "100%"
}).load(function(e){
console.log("Executed #frame1 load");
}).appendTo(uxcontainerPath);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With