{"id":1460,"date":"2025-03-22T14:06:53","date_gmt":"2025-03-22T07:06:53","guid":{"rendered":"https:\/\/siammakemoney.com\/?p=1460"},"modified":"2025-07-20T16:05:34","modified_gmt":"2025-07-20T09:05:34","slug":"javascript-prevents-copying","status":"publish","type":"post","link":"https:\/\/siammakemoney.com\/en\/javascript-prevents-copying\/","title":{"rendered":"10 JavaScript codes to prevent copying \u274c Do not copy text on the website."},"content":{"rendered":"<h2 class=\"wp-block-heading has-text-color has-link-color wp-elements-9ddc246898192c7c037fd05431606d7d\" style=\"color:#ab3a17\">Anti-copy code<\/h2>\n\n\n\n<p>JavaScript Code to Prevent Copying Text on Website, No Right Click, No Text Coverage If you want to prevent users from copying or pasting the content on your website, you can use JavaScript to prevent text selection and disable the copy command. You can use the following code:<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-green-color has-text-color has-link-color wp-elements-0abcf1b0ded62039cb611b405359f367\" style=\"font-size:24px\">1. Prevent dragging + prohibit Ctrl + A, C in a single code.<\/h3>\n\n\n\n<pre class=\"wp-block-code has-layout-color has-primary-background-color has-text-color has-background has-link-color wp-elements-3f97c424596f8f73de310cff29145e61\" data-no-translation=\"\" data-no-auto-translation=\"\"><code>&lt;script&gt;\nfunction disableselect(e) {\n    return false;\n}\nfunction reEnable() {\n    return true;\n}\n\ndocument.onselectstart = new Function (\"return false\");\nif (window.sidebar) {\n    document.onmousedown = disableselect;\n    document.onclick = reEnable;\n}\n\ndocument.addEventListener(\"keydown\", function (event) {\n    if (event.ctrlKey &amp;&amp; (event.key === \"a\" || event.key === \"c\")) {\n        event.preventDefault();\n        alert(\"<em>Sorry! This command cannot be used.<\/em>\");\n    }\n});\n&lt;\/script&gt;<\/code><\/pre>\n\n\n<style scoped>\n            .gc-box{margin-bottom:30px;padding:20px;border-left:5px solid transparent;line-height:24px}.gc-box .label-info{background-color:#5bc0de;display:inline-block;margin:0 5px 10px 0;padding:3px 6px;font-size:75%;font-weight:700;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em;line-height:14px}.gc-box.green_type{color:#3c763d;background-color:#dff0d8;border-color:#cae6be}.gc-box.blue_type{color:#31708f;background-color:#d9edf7;border-color:#bcdff1}.gc-box.red_type{color:#a94442;background-color:#f2dede;border-color:#e8c4c4}.gc-box.grey_type{background:#ddd;border-color:#ccc;color:#444}.gc-box.info_type{color:#155724;background-color:#d4edda;border-color:#c3e6cb}.gc-box.info_type svg{fill:#30a030}.gc-box.download_type{color:#004085;background-color:#cce5ff;border-color:#b8daff}.gc-box.download_type svg{fill:#3a9aff}.gc-box.update_type{color:#004458;background-color:#d9edf7;border:1px solid #bce8f1}.gc-box.notice_type{color:#856404;background-color:#fff3cd;border-color:#ffeeba}.gc-box.notice_type svg{fill:#f7a000}.gc-box.error_type{color:#721c24;background-color:#f8d7da;border-color:#f5c6cb}.gc-box.error_type svg{fill:#c70000}.gc-box.border_type{border:2px solid #ddd}.gc-box.icon_type{display:flex}.gc-box.icon_type .gc-box-icon{width:28px}.gc-box.icon_type .gc-box-text{flex-grow:1;margin:0 15px}.gc-box-text > *{margin-bottom: 20px;}\n        .gc-box-text > *:last-child{margin-bottom:0}        \n        <\/style><div class=\"gc-box border_type\" style=\"text-align:left;border-radius:20px;box-shadow: 0 10px 10px #00000007\">\n\t\t\t<div class=\"gc-box-icon\"><\/div>\n\t\t\t\n\t\t\t<div class=\"gc-box-text\">\n\n<p>This code uses JavaScript to prevent text selection and disable certain keyboard shortcuts (such as Ctrl+A and Ctrl+C) on a web page. The code works like this:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>disableselect(e)<\/code><\/strong> \u2192 Use to restore <code>false<\/code> To prevent text selection<\/li>\n\n\n\n<li><strong><code>reEnable()<\/code><\/strong> \u2192 Restore <code>true<\/code> To enable re-clicking (used in some older browsers)<\/li>\n\n\n\n<li><strong><code>document.onselectstart<\/code><\/strong> \u2192 It is an Event Handler that runs when text selection is started (<code>selectstart<\/code>)<\/li>\n\n\n\n<li><strong><code>new Function(&#034;return false&#034;)<\/code><\/strong> \u2192 Close text selection by resetting <code>false<\/code><\/li>\n\n\n\n<li><strong><code>window.sidebar<\/code><\/strong> \u2192 Use to check if the browser is <strong>Firefox<\/strong> (Mozilla&#039;s old browser)<\/li>\n\n\n\n<li><strong><code>document.onmousedown = disableselect;<\/code><\/strong> \u2192 Disable text selection when mouse is pressed<\/li>\n\n\n\n<li><strong><code>document.onclick = reEnable;<\/code><\/strong> \u2192 Enable clicks (so that all clicks are not blocked)<\/li>\n\n\n\n<li><strong><code>event.ctrlKey<\/code><\/strong> \u2192 Check that the button <code>Ctrl<\/code> Are you being suppressed?<\/li>\n\n\n\n<li><strong><code>event.key === &#034;a&#034;<\/code><\/strong> \u2192 Check if the user pressed <code>Ctrl + A<\/code> (Select all)<\/li>\n\n\n\n<li><strong><code>event.key === &#034;c&#034;<\/code><\/strong> \u2192 Check if the user pressed <code>Ctrl + C<\/code> (Copy)<\/li>\n\n\n\n<li><strong><code>event.preventDefault();<\/code><\/strong> \u2192 Block the operation of shortcut keys<\/li>\n\n\n\n<li><strong><code>alert(&#034;Sorry! This command cannot be used.&#034;);<\/code><\/strong> \u2192 Show notification message<\/li>\n<\/ul>\n\n<\/div>\n\t\t<\/div>\n\n\n<h3 class=\"wp-block-heading has-green-color has-text-color has-link-color wp-elements-f05beb1564599da669224d4ea6ac6d52\" style=\"font-size:24px\">2. Do not drag-cover the text.<\/h3>\n\n\n\n<pre class=\"wp-block-code has-layout-color has-primary-background-color has-text-color has-background has-link-color wp-elements-26e4dcdbe525e5ad218b02ce5cbc06c3\" data-no-translation=\"\" data-no-auto-translation=\"\"><code>&lt;script&gt;\ndocument.addEventListener(\"selectstart\", function (event) {\n    let target = event.target;\n\n    \/\/ Disable text selection for other sections\n    event.preventDefault();\n});\n\n&lt;\/script&gt;<\/code><\/pre>\n\n\n<div class=\"gc-box border_type\" style=\"text-align:left;border-radius:20px;box-shadow: 0 10px 10px #00000007\">\n\t\t\t<div class=\"gc-box-icon\"><\/div>\n\t\t\t\n\t\t\t<div class=\"gc-box-text\">\n\n<p>\u0e43\u0e0a\u0e49 document.addEventListener(&#8220;selectstart&#8221;, function (event) {\u2026})<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Capture the event <code>&#034;selectstart&#034;<\/code><\/strong> This occurs when the user tries to select text.<\/li>\n\n\n\n<li><strong><code>event.preventDefault();<\/code><\/strong> \u2192 Disable text selection across all web pages<\/li>\n<\/ul>\n\n<\/div>\n\t\t<\/div>\n\n\n<h3 class=\"wp-block-heading has-green-color has-text-color has-link-color wp-elements-63de42e2942f97ae1e946118b0435333\" style=\"font-size:24px\">3. Do not cover text and exclude some classes.<\/h3>\n\n\n\n<pre class=\"wp-block-code has-layout-color has-primary-background-color has-text-color has-background has-link-color wp-elements-dabd3e7bd443f84d8930c514c548cc2f\" data-no-translation=\"\" data-no-auto-translation=\"\"><code>&lt;script&gt;\ndocument.addEventListener(\"selectstart\", function (event) {\n    let target = event.target;\n\n    \/\/ <em>Check if the target class starts with \"wp-block-code\".<\/em>\n    while (target) {\n        if (target.classList &amp;&amp; &#91;...target.classList].some(cls =&gt; cls.startsWith(\"wp-block-code\"))) {\n            return; \/\/ <em>Allow text selection<\/em>\n        }\n        target = target.parentElement;\n    }\n\n    \/\/ <em>Disable text selection for other sections<\/em>\n    event.preventDefault();\n});\n\n&lt;\/script&gt;<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading has-text-align-center has-text-color has-link-color wp-elements-4da43a84a810eaf23f1fc7ff102e41e6\" style=\"color:#e39427\">For  Child Theme WordPress  &#8211; functions.php<\/h4>\n\n\n\n<pre class=\"wp-block-code has-layout-color has-primary-background-color has-text-color has-background has-link-color wp-elements-ebf393a94a1cbdb45990aaf5b7ed9bf3\" data-no-translation=\"\" data-no-auto-translation=\"\"><code>function custom_child_theme_selection_script() {\n    wp_register_script('child-selection-handler', false);\n    wp_enqueue_script('child-selection-handler');\n\n    $script = &lt;&lt;&lt;JS\ndocument.addEventListener(\"selectstart\", function (event) {\n    let target = event.target;\n\n    while (target) {\n        if (target.classList &amp;&amp; &#91;...target.classList].some(cls =&gt; cls.startsWith(\"wp-block-code\"))) {\n            return;\n        }\n        target = target.parentElement;\n    }\n\n    event.preventDefault();\n});\nJS;\n\n    wp_add_inline_script('child-selection-handler', $script);\n}\nadd_action('wp_enqueue_scripts', 'custom_child_theme_selection_script');\n<\/code><\/pre>\n\n\n<div class=\"gc-box border_type\" style=\"text-align:left;border-radius:20px;box-shadow: 0 10px 10px #00000007\">\n\t\t\t<div class=\"gc-box-icon\"><\/div>\n\t\t\t\n\t\t\t<div class=\"gc-box-text\">\n\n<p><strong>Capture the event <code>&#034;selectstart&#034;<\/code><\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Occurs when the user attempts to drag to select text.<\/li>\n<\/ul>\n\n\n\n<p><strong>Check if the user is trying to select text in <code>&lt;pre class=\"wp-block-code\"&gt;<\/code> Or not<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>use <code>while (target)<\/code> To check the element and parent element<\/li>\n\n\n\n<li>if <code>target<\/code> have <code>class<\/code> at <strong>Starting with<\/strong> <code>&#034;wp-block-code&#034;<\/code> \u2192 <strong>Allow text selection<\/strong><\/li>\n\n\n\n<li>use <code>target.classList.some(cls =&gt; cls.startsWith(&#034;wp-block-code&#034;))<\/code> To check<\/li>\n<\/ul>\n\n\n\n<p><strong>If not selected in <code>wp-block-code<\/code> \u2192 Close text selection<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>event.preventDefault();<\/code> Disable text selection everywhere <strong>except<\/strong> <code>wp-block-code<\/code><\/li>\n<\/ul>\n\n<\/div>\n\t\t<\/div>\n\n\n<h3 class=\"wp-block-heading has-green-color has-text-color has-link-color wp-elements-5324f0243efa45d5002df213d37cb2c8\" style=\"font-size:24px\">4. Copy protection code on web pages<\/h3>\n\n\n\n<pre class=\"wp-block-code has-layout-color has-primary-background-color has-text-color has-background has-link-color wp-elements-b629507e7ca89aedb292dc26110bc5fe\" data-no-translation=\"\" data-no-auto-translation=\"\"><code>&lt;script&gt;\ndocument.addEventListener('copy', function (e) {\n    e.preventDefault();\n    alert('<em>Sorry! The content cannot be copied.<\/em>');\n});\n&lt;\/script&gt;<\/code><\/pre>\n\n\n<div class=\"gc-box border_type\" style=\"text-align:left;border-radius:20px;box-shadow: 0 10px 10px #00000007\">\n\t\t\t<div class=\"gc-box-icon\"><\/div>\n\t\t\t\n\t\t\t<div class=\"gc-box-text\">\n\n<p><strong>1\ufe0f\u20e3 Event capture <code>copy<\/code><\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>use <code>document.addEventListener(&#039;copy&#039;, function (e) {...})<\/code><\/li>\n\n\n\n<li>When the user presses <code>Ctrl + C<\/code> \u0e2b\u0e23\u0e37\u0e2d\u0e04\u0e25\u0e34\u0e01\u0e02\u0e27\u0e32\u0e41\u0e25\u0e49\u0e27\u0e40\u0e25\u0e37\u0e2d\u0e01 &#8220;\u0e04\u0e31\u0e14\u0e25\u0e2d\u0e01&#8221; \u2192 \u0e1f\u0e31\u0e07\u0e01\u0e4c\u0e0a\u0e31\u0e19\u0e19\u0e35\u0e49\u0e08\u0e30\u0e17\u0e33\u0e07\u0e32\u0e19<\/li>\n<\/ul>\n\n\n\n<p><strong>2\ufe0f\u20e3 <code>e.preventDefault();<\/code><\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Block copying (<code>copy event<\/code>)<\/li>\n\n\n\n<li>Users will <strong>Unable to copy text<\/strong> Go to clipboard<\/li>\n<\/ul>\n\n\n\n<p><strong>3\ufe0f\u20e3 Notification (<code>alert(...)<\/code>)<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Show message <code>&#034;Sorry! The content cannot be copied.&#034;<\/code><\/li>\n\n\n\n<li>Notify users that copying is blocked<\/li>\n<\/ul>\n\n<\/div>\n\t\t<\/div>\n\n\n<h3 class=\"wp-block-heading has-green-color has-text-color has-link-color wp-elements-43ebf78ac848483be245afffbc588a23\" style=\"font-size:24px\">5. Disable Right Click with Notification<\/h3>\n\n\n\n<pre class=\"wp-block-code has-layout-color has-primary-background-color has-text-color has-background has-link-color wp-elements-b0702266239960cdccf5b23107ad9039\" data-no-translation=\"\" data-no-auto-translation=\"\"><code>&lt;script&gt;\nvar message = \"Do not click right..!!\";\ndocument.addEventListener(\"contextmenu\", function (e) {\n    e.preventDefault();\n    alert(message);\n});\n&lt;\/script&gt;<\/code><\/pre>\n\n\n<div class=\"gc-box border_type\" style=\"text-align:left;border-radius:20px;box-shadow: 0 10px 10px #00000007\">\n\t\t\t<div class=\"gc-box-icon\"><\/div>\n\t\t\t\n\t\t\t<div class=\"gc-box-text\">\n\n<p>This code works to prevent right click on web page using JavaScript. The given function will catch the right click event (<code>context menu event<\/code>) and blocks the right-click menu from appearing. It also displays an alert box to inform the user that right-clicking is blocked. The alert message is predefined in a variable and is displayed when a right-click is made.<\/p>\n\n<\/div>\n\t\t<\/div>\n\n\n<h3 class=\"wp-block-heading has-green-color has-text-color has-link-color wp-elements-b6959f5bf11707f6e86956f1a5bacf15\" style=\"font-size:24px\">6. Disable right click without displaying notification message.<\/h3>\n\n\n\n<pre class=\"wp-block-code has-layout-color has-primary-background-color has-text-color has-background has-link-color wp-elements-f437210c8efa29694dcffb33fd0c1318\" data-no-translation=\"\" data-no-auto-translation=\"\"><code>&lt;script&gt;\ndocument.addEventListener(\"contextmenu\", function (e) {\n    e.preventDefault();\n});\n&lt;\/script&gt;<\/code><\/pre>\n\n\n<div class=\"gc-box border_type\" style=\"text-align:left;border-radius:20px;box-shadow: 0 10px 10px #00000007\">\n\t\t\t<div class=\"gc-box-icon\"><\/div>\n\t\t\t\n\t\t\t<div class=\"gc-box-text\">\n\n<p>This code uses JavaScript to disable the right-click menu on a web page by listening for an event. <code>context menu<\/code> This occurs when a user right-clicks on a web page and uses the command <code>e.preventDefault()<\/code> To prevent the right-click menu from being displayed in browsers.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Capture the event <code>context menu<\/code><\/strong>: When a user right-clicks on a web page<\/li>\n\n\n\n<li><strong><code>e.preventDefault()<\/code><\/strong>: \u0e1b\u0e34\u0e14\u0e01\u0e32\u0e23\u0e41\u0e2a\u0e14\u0e07\u0e40\u0e21\u0e19\u0e39\u0e04\u0e25\u0e34\u0e01\u0e02\u0e27\u0e32\u0e02\u0e2d\u0e07\u0e40\u0e1a\u0e23\u0e32\u0e27\u0e4c\u0e40\u0e0b\u0e2d\u0e23\u0e4c, \u0e0b\u0e36\u0e48\u0e07\u0e1b\u0e01\u0e15\u0e34\u0e08\u0e30\u0e0a\u0e48\u0e27\u0e22\u0e43\u0e2b\u0e49\u0e1c\u0e39\u0e49\u0e43\u0e0a\u0e49\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e40\u0e02\u0e49\u0e32\u0e16\u0e36\u0e07\u0e1f\u0e31\u0e07\u0e01\u0e4c\u0e0a\u0e31\u0e19\u0e40\u0e0a\u0e48\u0e19 &#8220;\u0e04\u0e31\u0e14\u0e25\u0e2d\u0e01&#8221;, &#8220;\u0e14\u0e39\u0e41\u0e2b\u0e25\u0e48\u0e07\u0e17\u0e35\u0e48\u0e21\u0e32&#8221; \u0e40\u0e1b\u0e47\u0e19\u0e15\u0e49\u0e19<\/li>\n<\/ul>\n\n\n\n<p>The result is <strong>Users will not be able to right-click.<\/strong> On the web page that uses this code.<\/p>\n\n<\/div>\n\t\t<\/div>\n\n\n<h3 class=\"wp-block-heading has-green-color has-text-color has-link-color wp-elements-86e6afe15f329f5b0abae724b5e72b20\" style=\"font-size:24px\">7. Use CSS to prevent text copying.<\/h3>\n\n\n\n<pre class=\"wp-block-code has-layout-color has-primary-background-color has-text-color has-background has-link-color wp-elements-03730d2564e752917bd9b013aec0e178\" data-no-translation=\"\" data-no-auto-translation=\"\"><code>\/* Prevent text selection with CSS *\/\nbody {\n    user-select: none;\n}<\/code><\/pre>\n\n\n<div class=\"gc-box border_type\" style=\"text-align:left;border-radius:20px;box-shadow: 0 10px 10px #00000007\">\n\t\t\t<div class=\"gc-box-icon\"><\/div>\n\t\t\t\n\t\t\t<div class=\"gc-box-text\">\n\n<p>This code is used <strong>CSS<\/strong> To lock text selection on a web page by setting <strong><code>user-select: none;<\/code><\/strong> In the style of tags <code>&lt;body&gt;<\/code>. The code works as follows:<\/p>\n\n\n\n<p>Unable to drag the mouse to select text.<\/p>\n\n\n\n<p><strong><code>user-select: none;<\/code><\/strong>: Prevent users from selecting text on a web page.<\/p>\n\n\n\n<p><strong>Use with tags <code>&lt;body&gt;<\/code><\/strong> Prevent all text on the page from being selected.<\/p>\n\n<\/div>\n\t\t<\/div>\n\n\n<h3 class=\"wp-block-heading has-green-color has-text-color has-link-color wp-elements-e9cca1c919438703038ec4b75d19ab54\" style=\"font-size:24px\">8. Prevent dragging and dropping text (Disable Drag &amp; Drop)<\/h3>\n\n\n\n<p>This code prevents dragging or dropping of content or images elsewhere.<\/p>\n\n\n\n<pre class=\"wp-block-code has-layout-color has-primary-background-color has-text-color has-background has-link-color wp-elements-3a6d8874c7d98a99cd2bd8f650bfdc50\" data-no-translation=\"\" data-no-auto-translation=\"\"><code>&lt;script&gt;\ndocument.addEventListener(\"dragstart\", function (e) {\n    e.preventDefault();\n});\ndocument.addEventListener(\"drop\", function (e) {\n    e.preventDefault();\n});\n&lt;\/script&gt;<\/code><\/pre>\n\n\n<div class=\"gc-box border_type\" style=\"text-align:left;border-radius:20px;box-shadow: 0 10px 10px #00000007\">\n\t\t\t<div class=\"gc-box-icon\"><\/div>\n\t\t\t\n\t\t\t<div class=\"gc-box-text\">\n\n<p>This code is used <strong>JavaScript<\/strong> To prevent dragging and dropping on web pages, use: <code>preventDefault()<\/code> To disable both events<\/p>\n\n<\/div>\n\t\t<\/div>\n\n\n<h3 class=\"wp-block-heading is-style-default has-green-color has-text-color has-link-color wp-elements-c413c8ad572fcb2e99ccbefa9471c9f2\" style=\"font-size:24px\">9. Disable Inspect Element and View Source.<\/h3>\n\n\n\n<p>Disable <strong>Ctrl + U (View Source), Ctrl + Shift + I (Developer Tools), F12 (DevTools)<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code has-layout-color has-primary-background-color has-text-color has-background has-link-color wp-elements-ccef77f5ba12b5dd43c199c0ff316081\" data-no-translation=\"\" data-no-auto-translation=\"\"><code>&lt;script&gt;\ndocument.addEventListener(\"keydown\", function (e) {\n    if (e.ctrlKey &amp;&amp; (e.key === \"u\" || e.key === \"s\" || e.key === \"i\" || e.key === \"j\")) {\n        e.preventDefault();\n        alert(\"<em>Sorry! This command cannot be used.<\/em>\");\n    }\n    if (e.key === \"F12\") {\n        e.preventDefault();\n        alert(\"<em>Developer tools are disabled<\/em>\");\n    }\n});\n&lt;\/script&gt;<\/code><\/pre>\n\n\n<div class=\"gc-box border_type\" style=\"text-align:left;border-radius:20px;box-shadow: 0 10px 10px #00000007\">\n\t\t\t<div class=\"gc-box-icon\"><\/div>\n\t\t\t\n\t\t\t<div class=\"gc-box-text\">\n\n<p>This code is used <strong>JavaScript<\/strong> To prevent the use of certain commands that can help users access developer tools and functions on a web page, such as opening <strong>View Source<\/strong>, <strong>Inspect Element<\/strong>, or <strong>Developer Tools<\/strong> Through various shortcuts by capturing events <strong><code>keydown<\/code><\/strong> And prevent those orders too. <code>preventDefault()<\/code>.<\/p>\n\n\n\n<p><strong>Inspection <code>Ctrl + U<\/code>, <code>Ctrl + S<\/code>, <code>Ctrl + I<\/code>, <code>Ctrl + J<\/code>:<\/strong><br>If the user presses <strong>Ctrl<\/strong> Hold and press <strong>IN<\/strong>, <strong>S<\/strong>, <strong>I<\/strong>, or <strong>J<\/strong> (This is a shortcut that is often used to open the source of a web page or development tool.)<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>e.preventDefault()<\/code> Disable this command<\/li>\n\n\n\n<li>Show notification message: <code>&#034;Sorry! This command cannot be used.&#034;<\/code><\/li>\n<\/ul>\n\n\n\n<p><strong>Button Check <code>F12<\/code>:<\/strong><br>If the user presses <strong>F12<\/strong> Which is the shortcut to open <strong>Developer Tools<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>e.preventDefault()<\/code> Disable Developer Tools<\/li>\n\n\n\n<li>Show notification message: <code>&#034;Developer tools are disabled&#034;<\/code><\/li>\n<\/ul>\n\n<\/div>\n\t\t<\/div>\n\n\n<h3 class=\"wp-block-heading has-green-color has-text-color has-link-color wp-elements-c0707ea72407c5c8b660b559184f9711\" style=\"font-size:23px\">10. Disable automatic text selection in browsers.<\/h3>\n\n\n\n<pre class=\"wp-block-code has-layout-color has-primary-background-color has-text-color has-background has-link-color wp-elements-f6d38d1bfe092653af9d83e66fc81521\" data-no-translation=\"\" data-no-auto-translation=\"\"><code>css Copy Edit\/* Disable text selection and data dragging *\/\nbody, p, span, div {\n    user-select: none;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n}<\/code><\/pre>\n\n\n<div class=\"gc-box border_type\" style=\"text-align:left;border-radius:20px;box-shadow: 0 10px 10px #00000007\">\n\t\t\t<div class=\"gc-box-icon\"><\/div>\n\t\t\t\n\t\t\t<div class=\"gc-box-text\">\n\n<p>This CSS code is used to <strong>Prevent text selection<\/strong> (text selection) and dragging data (dragging) on \u200b\u200bweb pages using <code>user-select: none;<\/code> and support for different browsers<\/p>\n\n\n\n<p><strong>Job details:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong><code>user-select: none;<\/code><\/strong>\n<ul class=\"wp-block-list\">\n<li>Prevents users from selecting text within a specified HTML element (in this case: <code>body<\/code>, <code>p<\/code>, <code>span<\/code>, <code>div<\/code>)<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong><code>-webkit-user-select: none;<\/code><\/strong>\n<ul class=\"wp-block-list\">\n<li>For use with browsers <strong>WebKit<\/strong> engine (such as <strong>Chrome<\/strong>, <strong>Safari<\/strong>)<\/li>\n\n\n\n<li>It allows you to prevent text selection in these browsers.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong><code>-moz-user-select: none;<\/code><\/strong>\n<ul class=\"wp-block-list\">\n<li>Used for <strong>Firefox<\/strong><\/li>\n\n\n\n<li>Prevent text selection in Firefox<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong><code>-ms-user-select: none;<\/code><\/strong>\n<ul class=\"wp-block-list\">\n<li>Used for <strong>Internet Explorer<\/strong><\/li>\n\n\n\n<li>Prevent text selection in IE<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n<\/div>\n\t\t<\/div>\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>How to use Go to the header section \u2013 Insert the code inside the head.   <\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading has-text-color has-link-color wp-elements-56dfe94358adfdbbb0731672a8a2f64b\" style=\"color:#2d5e67;font-size:35px\">How to add anti-copy code to WordPress<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"490\" src=\"https:\/\/siammakemoney.com\/wp-content\/uploads\/2025\/03\/code-copy-1024x490.webp\" alt=\"\" class=\"wp-image-1490\" title=\"\" srcset=\"https:\/\/siammakemoney.com\/wp-content\/uploads\/2025\/03\/code-copy-1024x490.webp 1024w, https:\/\/siammakemoney.com\/wp-content\/uploads\/2025\/03\/code-copy-300x144.webp 300w, https:\/\/siammakemoney.com\/wp-content\/uploads\/2025\/03\/code-copy-768x368.webp 768w, https:\/\/siammakemoney.com\/wp-content\/uploads\/2025\/03\/code-copy-1536x735.webp 1536w, https:\/\/siammakemoney.com\/wp-content\/uploads\/2025\/03\/code-copy-400x191.webp 400w, https:\/\/siammakemoney.com\/wp-content\/uploads\/2025\/03\/code-copy-800x383.webp 800w, https:\/\/siammakemoney.com\/wp-content\/uploads\/2025\/03\/code-copy-832x398.webp 832w, https:\/\/siammakemoney.com\/wp-content\/uploads\/2025\/03\/code-copy-1664x796.webp 1664w, https:\/\/siammakemoney.com\/wp-content\/uploads\/2025\/03\/code-copy-1248x597.webp 1248w, https:\/\/siammakemoney.com\/wp-content\/uploads\/2025\/03\/code-copy.webp 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Go to your WordPress admin area, go to Appearance\/Theme File Editor menu.<\/li>\n\n\n\n<li>Right-hand side, choose the theme (you are currently using)<\/li>\n\n\n\n<li>Find the theme header (header.php)<\/li>\n\n\n\n<li>Place the code in<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading has-text-color has-link-color wp-elements-5fc11d7a332f75ebd9582167297c59f7\" style=\"color:#9c5d45cf;font-size:34px\">How to insert anti-copy code into Blogger<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"490\" src=\"https:\/\/siammakemoney.com\/wp-content\/uploads\/2025\/03\/22-03-2025-17-29-31-painty-screenshot-1024x490.webp\" alt=\"Do not copy text.\" class=\"wp-image-1504\" title=\"\" srcset=\"https:\/\/siammakemoney.com\/wp-content\/uploads\/2025\/03\/22-03-2025-17-29-31-painty-screenshot-1024x490.webp 1024w, https:\/\/siammakemoney.com\/wp-content\/uploads\/2025\/03\/22-03-2025-17-29-31-painty-screenshot-300x144.webp 300w, https:\/\/siammakemoney.com\/wp-content\/uploads\/2025\/03\/22-03-2025-17-29-31-painty-screenshot-768x368.webp 768w, https:\/\/siammakemoney.com\/wp-content\/uploads\/2025\/03\/22-03-2025-17-29-31-painty-screenshot-1536x735.webp 1536w, https:\/\/siammakemoney.com\/wp-content\/uploads\/2025\/03\/22-03-2025-17-29-31-painty-screenshot-400x191.webp 400w, https:\/\/siammakemoney.com\/wp-content\/uploads\/2025\/03\/22-03-2025-17-29-31-painty-screenshot-800x383.webp 800w, https:\/\/siammakemoney.com\/wp-content\/uploads\/2025\/03\/22-03-2025-17-29-31-painty-screenshot-832x398.webp 832w, https:\/\/siammakemoney.com\/wp-content\/uploads\/2025\/03\/22-03-2025-17-29-31-painty-screenshot-1664x796.webp 1664w, https:\/\/siammakemoney.com\/wp-content\/uploads\/2025\/03\/22-03-2025-17-29-31-painty-screenshot-1248x597.webp 1248w, https:\/\/siammakemoney.com\/wp-content\/uploads\/2025\/03\/22-03-2025-17-29-31-painty-screenshot.webp 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Go to the Theme menu. <a href=\"https:\/\/siammakemoney.com\/en\/%e0%b8%aa%e0%b8%ad%e0%b8%99%e0%b8%aa-%e0%b8%a3%e0%b9%89%e0%b8%b2%e0%b8%87-blogger-%e0%b8%a0%e0%b8%b2%e0%b8%a2%e0%b9%83%e01tp3-tb8%992%e0%b8%99%e0%b8%b2%e0%b8%97%e0%b8%b5\/\">Blogger<\/a><\/li>\n\n\n\n<li>Click the drop-down button Edit HTML<\/li>\n\n\n\n<li>\u0e43\u0e2a\u0e48\u0e42\u0e04\u0e49\u0e14 \u0e20\u0e32\u0e22\u0e43\u0e19 &lt;head><\/li>\n\n\n\n<li>or &ndash; Place your code before closing tag. &lt;\/body&gt;<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">note<\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>although<a href=\"https:\/\/siammakemoney.com\/en\/category\/html-css-javascript\/\">code<\/a>These will reduce the chances of content being copied from your website, but they are not 100% foolproof, as users can still access the information using developer tools or browser extensions. So, if you want to protect your content, consider taking additional measures, such as adding a watermark to your images or using a membership system to restrict access to sensitive content.<\/p>\n\n\n\n<p>Hopefully these codes will be useful to prevent copying text on your website! \ud83d\ude80<\/p>\n\n\n\n<p><\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"\u0e2b\u0e32\u0e01\u0e04\u0e38\u0e13\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23\u0e1b\u0e49\u0e2d\u0e07\u0e01\u0e31\u0e19\u0e44\u0e21\u0e48\u0e43\u0e2b\u0e49\u0e1c\u0e39\u0e49\u0e43\u0e0a\u0e49\u0e04\u0e31\u0e14\u0e25\u0e2d\u0e01\u0e2b\u0e23\u0e37\u0e2d\u0e01\u0e4a\u0e2d\u0e1a\u0e1b\u0e35\u0e49\u0e40\u0e19\u0e37\u0e49\u0e2d\u0e2b\u0e32 \u0e2b\u0e49\u0e32\u0e21\u0e04\u0e31\u0e14\u0e25\u0e2d\u0e01\u0e02\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21 \u0e1a\u0e19\u0e40\u0e27\u0e47\u0e1a\u0e44\u0e0b\u0e15\u0e4c\u0e02\u0e2d\u0e07\u0e04\u0e38\u0e13 \u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e43\u0e0a\u0e49 JavaScript \u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e1b\u0e49\u0e2d\u0e07\u0e01\u0e31\u0e19\u0e01\u0e32\u0e23\u0e25\u0e32\u0e01\u0e04\u0e25\u0e38\u0e21\u0e02\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21 (Text Selection) \u0e41\u0e25\u0e30\u0e1b\u0e34\u0e14\u0e01\u0e32\u0e23\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19\u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e04\u0e31\u0e14\u0e25\u0e2d\u0e01 (Copy) \u0e44\u0e14\u0e49 \u0e42\u0e14\u0e22\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e43\u0e0a\u0e49\u0e42\u0e04\u0e49\u0e14\u0e15\u0e48\u0e2d\u0e44\u0e1b\u0e19\u0e35\u0e49:","protected":false},"author":1,"featured_media":1490,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"csco_singular_sidebar":"right","csco_page_header_type":"title","csco_page_load_nextpost":"","footnotes":""},"categories":[28,23],"tags":[],"class_list":{"0":"post-1460","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-html-css-javascript","8":"category-website-creation","9":"cs-entry"},"_links":{"self":[{"href":"https:\/\/siammakemoney.com\/en\/wp-json\/wp\/v2\/posts\/1460","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/siammakemoney.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/siammakemoney.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/siammakemoney.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/siammakemoney.com\/en\/wp-json\/wp\/v2\/comments?post=1460"}],"version-history":[{"count":44,"href":"https:\/\/siammakemoney.com\/en\/wp-json\/wp\/v2\/posts\/1460\/revisions"}],"predecessor-version":[{"id":2682,"href":"https:\/\/siammakemoney.com\/en\/wp-json\/wp\/v2\/posts\/1460\/revisions\/2682"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/siammakemoney.com\/en\/wp-json\/wp\/v2\/media\/1490"}],"wp:attachment":[{"href":"https:\/\/siammakemoney.com\/en\/wp-json\/wp\/v2\/media?parent=1460"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/siammakemoney.com\/en\/wp-json\/wp\/v2\/categories?post=1460"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/siammakemoney.com\/en\/wp-json\/wp\/v2\/tags?post=1460"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}