Forum Moderators: open
this is the best i can do, unfortunately it works only with internet explorer. I'm sure there is a better way, just i don't know it. Here's what i have:
<html>
<head>
<script type="text/javascript">
function sendToClipboard(s)
{
if( window.clipboardData && clipboardData.setData )
{
clipboardData.setData("Text", s);
}
else
{
alert("Internet Explorer required");
}
}
</script>
</head>
<body>
<button onclick="sendToClipboard('Text to be copied')">
Send text to clipboard</button>
</body>
</html>
Hope this helps somewhat...
eelix
I've also found this script: [dynamicdrive.com...]
And had a go at taking it apart, but I can't seem to get it to work! I made this:
function copythis(tocopy) {
therange = tocopy.createTextRange()
therange.execCommand("Copy")
window.status="Copied image's URL to clipboard!"
setTimeout("window.status=''",1800)
}
but I get an error (from javascript console (FireFox extension)) that says that 'createTextRange()' isn't defined! I donno what to do!
You would need to first detect the browser and then apply one of the methods above to IE and different one to Firefox.