Skip to content

Instantly share code, notes, and snippets.

@grafst
Last active March 13, 2019 13:43
Show Gist options
  • Save grafst/804353a539e7daa2c6c4e148a370ace1 to your computer and use it in GitHub Desktop.
Save grafst/804353a539e7daa2c6c4e148a370ace1 to your computer and use it in GitHub Desktop.
clipboard access in internet explorer
<!-- Acces Clipboard in Internetexplorer-->
<html>
<head>
<script type="text/javascript">
function CopyToClipboard(elementId){
var input = document.getElementById(elementId);
window.clipboardData.setData ("Text", input.value);
}
function GetClipboardContent(){
return (window.clipboardData.getData("Text"));
}
function ClearClipboard(){
window.clipboardData.clearData("Text");
}
</script>
</head>
<body>
<input id="toClipboard" value="text to clipboard"/>
<button onclick='CopyToClipboard("toClipboard")'>Copy text to clipboard</button>
<br/><br/>
<button onclick='alert(GetClipboardContent())'>Show text data in clipboard</button>
<button onclick='ClearClipboard();'>Clear text data from clipboard</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment