I’m looking to load a webpage into an iframe via a string output from PHP. Every example I’ve seen showing this is Javascript based.
Curious is there is a jQuery method to accomplish loading a string as the content for an iframe?
This is the Javscript (partial jQuery) implementation I’m currently using:
<script type="text/javascript">
$(function() {
setTimeout( function() {
var resume = document.getElementById('resume_holder')
var doc = resume.contentWindow.document;
var $body = $('body',doc);
var htmlString = "<h1>TEST</h1>";
$body.html(htmlString);
}, 1 );
});
</script>
.contents()instead of.contentWindow.document/.contentDocument..contents(), called on a frame element, returns the document, wrapped in a jQuery object.$(doc).find('body')is a faster equivalent to$('body', doc).