POST TIME:2021-05-21 00:15
當(dāng)復(fù)制文章內(nèi)容時,自動加版權(quán)與文章詳細(xì)頁網(wǎng)址的實現(xiàn)方法:
將下面的js代碼插入到文章內(nèi)容頁模板的<head>與</head>標(biāo)簽中間就行
<script language=”javascript” type=”text/javascript”>
<!–
document.body.oncopy = function () {
setTimeout( function () {
var text = clipboardData.getData(“text”);
if (text) {
text = text + “ 文章來自:darren中詳文參考:”+location.href;
clipboardData.setData(“text”, text);
}
}, 100 )
}
–>
</script>
只需要寫上上面的版權(quán)代碼,那么功能就已經(jīng)OK了.