This question already has an answer here:
- Copy Image to Clipboard from Browser in Javascript? 2 answers
I need to copy an image to clipboard using JavaScript/jquery and I am using the following js to achieve that.
function copyImageToClipBoard() {
var div = document.getElementById('chart1');
div.contentEditable = true;
var controlRange;
if (document.body.createControlRange) {
controlRange = document.body.createControlRange();
controlRange.addElement(div);
controlRange.execCommand('Copy');
}
div.contentEditable = false;
}
It works fine locally in IE. But when I tried to test it from other machines IE, to paste the image into MS word I need to use the Paste Special-> Device Independent Bitmap option, otherwise I cannot see the image pasted.
I was wondering if it has anything to do with the environment of the m/c. If so is there any other option which works anywhere?