How to copy a div's content to clipboard without flash
问题 That's it :) I have a div with the id #toCopy , and a button with the id #copy . What's the best way to copy #toCopy content to clipboard when pressing #copy ? 回答1: UPDATED ANSWER Javascript was restricted from using the clipboard, early on. but nowadays it supports copy/paste commands. See documentation of mozilla and caniuse.com. document.execCommand('paste') make sure that you support browsers that don't. https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand http://caniuse