原作者:hzmumu
https://blog.csdn.net/hzmumu/article/details/79271464
非常感谢
本人亲测可以兼容
<button onClick="copy('把内容读到这里')" >
复制链接
</button>
<script>
function copy(message) {
console.log(1);
var input = document.createElement("input");
input.value = message;
document.body.appendChild(input);
input.select();
input.setSelectionRange(0, input.value.length), document.execCommand('Copy');
document.body.removeChild(input);
}
</script>