Copy image to Clipboard not working in Firefox & Chrome
Possible Duplicate:
How to copy to the clipboard in JavaScript?
I need one help regards JavaScript. I used this script in asp.net website.
<script type="text/javascript">
function CopyToClip() {
var imgControl = document.getElementById('imageControlWithImageToCopy');
imgControl.contentEditable = 'true';
var controlRange;
if (document.body.createControlRange) {
controlRange = document.body.createControlRange();
controlRange.addElement(imgControl);
controlRange.execCommand('Copy');
}
imgControl.contentEditable = 'false';
return true;
}
</script>
This code for copying image (which is in an image control) to clipboard and it works fine in IE.
But this script is not working in Firefox & Chrome.
Please suggest any good solution to work in Firefox & Chrome
Sorry, but you can't copy stuff into the clipboard in Chrome or Firefox. Internet Explorer has a small hole that lets you do this, but it's the pretty much the only browser that supports that type of functionality any more.
There's a Flash hack to make this possible, but that's only for text, sorry.
Take a look at here. Google chrome doesn't support copy to clipboard any more. You might wanna look into flash possible options. Found this one one too, but no more development.
链接地址: http://www.djcxy.com/p/19726.html上一篇: 使用Javascript复制选定的文本?