Các bạn thêm đoạn mã sau vào trong thẻ head của trang web Cách 1: Copy đầy đủ & Tự ghi nguồn HTML: <!-- / C.N.G - V.N.O --> <script type="text/javascript"> if(document.location.protocol=='http:'){ var Tynt=Tynt||[]; Tynt.push('ce4Ugik24r46FUacwqm_6r'); (function(){ var s=document.createElement('script'); s.async="async";s.type="text/javascript"; s.src='http://tcr.tynt.com/ti.js'; var h=document.getElementsByTagName('script')[0]; h.parentNode.insertBefore(s,h);})(); } </script> <!-- C.N.G - V.N.O / --> Demo: Bạn thử copy ở 1 vị trí bất kỳ tại dembuon.vn và paste thử. Cách 2: Copy sẽ ghi nguồn & Chỉ lấy được phần text HTML: <script type="text/javascript"> function addLink() { //Get the selected text and append the extra info var body_element = document.getElementsByTagName('body')[0]; var selection; selection = window.getSelection(); var pagelink = "<br /><br /> Nguồn bài viết: <a href='"+document.location.href+"'>"+document.location.href+"</a>"; var copytext = selection + pagelink; var newdiv = document.createElement('div'); //hide the newly created container newdiv.style.position='absolute'; newdiv.style.left='-99999px'; //insert the container, fill it with the extended text, and define the new selection body_element.appendChild(newdiv); newdiv.innerHTML = copytext; selection.selectAllChildren(newdiv); window.setTimeout(function() { body_element.removeChild(newdiv); },0); } document.oncopy = addLink; </script>
Cập nhật code mới: Hiện tại code làm theo cách 1 bên trên khi copy sẽ bị dính link của 1 trang web thứ 3. Các bạn thay thế bằng code dưới đây: Mã: <script> var Tynt=Tynt||[];Tynt.push('aF-6ySThKr55i6aKkv7mNO'); (function(){var h,s=document.createElement('script'); s.src=(window.location.protocol==='https:'? 'https':'http')+'://cdn.tynt.com/ti.js'; h=document.getElementsByTagName('script')[0]; h.parentNode.insertBefore(s,h);})(); </script>
Admin ơi cho hỏi, thẻ head ở đâu vậy, chỉ mình chi tiết chút được không, mình đang tính cài thêm cái này á. Hehe
Cặp thẻ <head>.. </head> nằm trên đầu tiên trong mã nguồn trang web của bạn, mà thực ra bạn chèn code đó vào phần nào của trang cũng được.
Chèn ơi cám ơn ad nhiều, giờ phải tìm thêm cách phá mấy đứa đi chôm truyện thui, chứ cài cái phần bảo vệ của web mình mà ad chỉ á, nó vẫn mò vào copy cho được luôn, cũng may chắc giờ nó thấy khó hay sau á nó đang ngưng rồi hihi
Nếu đã muốn copy tới cùng thì không có code nào chống lại được đâu bạn, 1 vài thủ thuật nhỏ là qua được hết ^^ chỉ là được chút nào hay chút đó để làm người ta nản chí hoặc e ngại thôi ^^
Thì đó, giờ có nhiều cách để copy lắm, nhưng mình làm cho nó nản thui chứ cũng đâu thể nào chống dc 100% được hihi. Thanks ad nhiều.