复制文章内容自动添加文章链接
代码如下,不多做解释:
<script>
document.body.oncopy = function ()
{ setTimeout( function () { var text = clipboardData.getData(“text”);
if (text) { text = text + “\n本文转载自:用键盘记录人生(http://www.pksafe.cn) \n文章地址:”+location.href; clipboardData.setData(“text”, text); } }, 100 ) }
</script>