We have a page using HTML5 that has an iframe (id="sermonwindow") in the middle of the page. We have a button on the parent page that copies the entire contents of the iframe to the clipboard.

The code we have is older and now only works in IE.

Code:
function CopyIframe() {
var r = document.sermonwindow.document.body.createTextRange();
r.execCommand("Copy");
}
There seems to be newer javascript code that works on the parent page, but it isn't written to select and copy all the contents of the iframe:

Code:
function CopyIframe() {
document.querySelector("#sermonwindow").select();
document.execCommand('copy');
}
So, can anyone help with how to copy the entire contents of the iframe window to the clipboard using javascript with HTML5 that works in most browsers?

Thanks.