How can I print the contents of an IFrame via a JavaScript call in Safari/Chrome?
This works in Firefox:
$('#' + id)[0].focus();
$('#' + id)[0].contentWindow.print();
This works in IE:
window.frames[id].focus();
window.frames[id].print();
But I can't get anything to work in Safari/Chrome.
Put a print function in the iframe and call it from the parent.
iframe:
function printMe() {
window.print()
}
parent:
document.frame1.printMe()