Setting Content Of Iframe Using Javascript Fails In Firefox
I'm trying to set the content of a iframe using javascript. I've the html string. And I'm writing:- var iframe = $('iframe')[0], content = '
test
';Solution 1:
I faced the same problem. I saw the load function of iframe fires in firefox but not in chrome. So firefox reload the iframe again on load event.
So with your existing code try this:-
$(iframe).load(function(e){
$(iframe).contents().find('html').html(content);
})
Post a Comment for "Setting Content Of Iframe Using Javascript Fails In Firefox"