Entry
How can I allow the user to select the page content and copy it to the clipboard?
Mar 16th, 2001 07:59
Martin Honnen,
IE4+ allows that:
<HTML>
<HEAD>
<TITLE>
copying page content to the clipboard
</TITLE>
</HEAD>
<BODY>
<INPUT TYPE="button" VALUE="copy page content to clipboard"
ONCLICK="if (document.body && document.body.createTextRange()) {
var range = document.body.createTextRange();
range.select();
document.execCommand('Copy');
document.selection.empty();
}"
>
<P>
All for Kibology.
</P>
<DIV>
Kibology for all.
</DIV>
<A HREF="http://JavaScript.FAQTs.com">
JavaScript.FAQTs.com
</A>
</BODY>
</HTML>
Though it should in my view be easier for the user to simply use Select
All->Copy from the edit or context menu.