Kali ini kita akan mencoba bagaimana menghilangkan fitur copy paste pada sebuah halaman website. Sebenarnya banyak sekali caranya, salah satunya adalah seperti berikut ini.
Disaat teman-teman tidak ingin artikel atau isi dari halaman website di copy oleh orang lain, kita bisa mensiasatinya dengan mendisable fitur tersebut, oke kita coba praktekan.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>anti-copy paste</title> <style> *{ padding: 0px; margin: 0px; } body{ font-family: 'arial', sans-serif; } #wrapper{ width: 960px; height: 700px; margin: auto; } #content{ margin-top: 50px; user-select: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; } </style> </head> <body> <div id="wrapper"> <div id="content"> <p>It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> <p>This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.</p> </div> </div> </body> </html>
Nah teman-teman coba perhatikan bagian ini:
#content{ margin-top: 50px; user-select: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; }
Dengan menggunakan salah satu alternatif ini kalian bisa mengatur, bagian mana yang akan di protek. Proses penyeleksian bisa di atur apakah keseluruhan dalam hal ini tag <body>
atau hanya isi atau #id content
saja.
Teman-teman bisa mencobanya di website kalian, modifikasi fitur tersebut sesuaikan dengan kebutuhan.
Happy Coding 🙂