如何给文章复制时添加自己网站的标记

如何给文章复制时添加自己网站的标记,这里介绍一个复制文章内容自动加上版权的小代码~

编辑文章模板文件,在适当位置加入下面这些代码即可。

<script type="text/javascript">
document.body.oncopy = function () {
setTimeout( function () {
var text = clipboardData.getData("text");
if (text) {
text = text + "本文来源http://www.cuplayer.com 原文地址:"+location.href;
clipboardData.setData("text",text);
}
}, 100 )
}
</script>

我的原创文章:

猜你喜欢

转载自blog.csdn.net/ffffffff8/article/details/104023298