I'm developing a feature of copying image. and It doesn't work for me on Chrome 70, Is this possible? I think it might be a security limitation.
The clipboard API allows only copying text, the write function is undefined
await navigator.clipboard.write([
new ClipboardItem({
[blob.type]: blob
})
])
also tried this implementation
function copyElementToClipboard(element) {
window.getSelection().removeAllRanges();
let range = document.createRange();
range.selectNode(typeof element === 'string' ? document.getElementById(elementName) : element);
window.getSelection().addRange(range);
document.execCommand('copy');
window.getSelection().removeAllRanges();
}
but it doesnt work.
How should I enable and implement this feature?