The answer is … you can’t! Well, generally speaking, that is.
Here are the reasons why:
First things first, for security reasons, you cannot even simulate running the context menu’s Copy Image command.
In Internet Explorer, you can copy a portion or all of the Canvas to an Image using document.body.createControlRange.
In some later versions of Firefox, the ClipboardEvent lets you do copy an Image to clipboard.
In Chrome, there is no way to do so except for some workaround using a littler helper called Flash.
Then again, Flash won’t work in Safari browser.
With these findings, to provide the same consistency across browsers, it is best not to add this feature to your web application for consistency reasons which can bring confusion to some users who are not technically inclined why they will be forced to use certain browsers that only this feature works.
/* Replace this with your clipboard.swf location */