{"id":2719,"date":"2015-08-10T05:42:33","date_gmt":"2015-08-10T05:42:33","guid":{"rendered":"http:\/\/www.vishmax.com\/en\/?p=2719"},"modified":"2015-08-10T05:42:33","modified_gmt":"2015-08-10T05:42:33","slug":"disable-text-selection-and-right-click-on-website-trick-with-code","status":"publish","type":"post","link":"https:\/\/www.vishmax.com\/en\/labs\/disable-text-selection-and-right-click-on-website-trick-with-code\/","title":{"rendered":"Disable text selection and right click on website &#8211; trick with code"},"content":{"rendered":"<p>This post explains how to protect a webpage from copying pages contents including text and image. Its is not possible to protect 100% but we can make it harder to copy contents  from a webpage.  In order to block the right-click activity we need to use JavaScript which is one of the best scripting languages used to enhance webpage functionality. Below is the code take a look and use on your webpage.<\/p>\n<h2>To Disable Context Menu<\/h2>\n<pre lang=\"javascript\">\r\n<script>\r\n\tdocument.oncontextmenu = function(){return false;};\r\n<\/script>\r\n<\/pre>\n<p>Paste above code on your webpage header section.<\/p>\n<h2>To Disable Text Selection<\/h2>\n<pre lang=\"javascript\">\r\n<script>\r\n\tdocument.onselectstart= function() {return false;};\r\n<\/script>\r\n<\/pre>\n<p>This will disable Selection in IE and Chrome, to do the same in Mozilla Firefox we need to use CSS to the body element. Copy and paste below CSS to your master CSS file body section.<\/p>\n<pre lang=\"css\">\r\n\t-moz-user-select: none;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This post explains how to protect a webpage from copying pages contents including text and image. Its is not possible to protect 100% but we can make it harder to copy contents from a webpage. In order to block the right-click activity we need to use JavaScript which is one of the best scripting languages [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[44],"tags":[67,53],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.2.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Disable text selection and right click on website - trick with code - Vishmax.com<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vishmax.com\/en\/labs\/disable-text-selection-and-right-click-on-website-trick-with-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Disable text selection and right click on website - trick with code - Vishmax.com\" \/>\n<meta property=\"og:description\" content=\"This post explains how to protect a webpage from copying pages contents including text and image. Its is not possible to protect 100% but we can make it harder to copy contents from a webpage. In order to block the right-click activity we need to use JavaScript which is one of the best scripting languages [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vishmax.com\/en\/labs\/disable-text-selection-and-right-click-on-website-trick-with-code\/\" \/>\n<meta property=\"og:site_name\" content=\"Vishmax.com\" \/>\n<meta property=\"article:published_time\" content=\"2015-08-10T05:42:33+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.vishmax.com\/en\/labs\/disable-text-selection-and-right-click-on-website-trick-with-code\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.vishmax.com\/en\/labs\/disable-text-selection-and-right-click-on-website-trick-with-code\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"http:\/\/www.vishmax.com\/en\/#\/schema\/person\/785fa94b56eb17ae7706d30777d6ab93\"},\"headline\":\"Disable text selection and right click on website &#8211; trick with code\",\"datePublished\":\"2015-08-10T05:42:33+00:00\",\"dateModified\":\"2015-08-10T05:42:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.vishmax.com\/en\/labs\/disable-text-selection-and-right-click-on-website-trick-with-code\/\"},\"wordCount\":135,\"publisher\":{\"@id\":\"http:\/\/www.vishmax.com\/en\/#organization\"},\"keywords\":[\"CSS\",\"jQuery\"],\"articleSection\":[\"Labs\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.vishmax.com\/en\/labs\/disable-text-selection-and-right-click-on-website-trick-with-code\/\",\"url\":\"https:\/\/www.vishmax.com\/en\/labs\/disable-text-selection-and-right-click-on-website-trick-with-code\/\",\"name\":\"Disable text selection and right click on website - trick with code - Vishmax.com\",\"isPartOf\":{\"@id\":\"http:\/\/www.vishmax.com\/en\/#website\"},\"datePublished\":\"2015-08-10T05:42:33+00:00\",\"dateModified\":\"2015-08-10T05:42:33+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.vishmax.com\/en\/labs\/disable-text-selection-and-right-click-on-website-trick-with-code\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.vishmax.com\/en\/labs\/disable-text-selection-and-right-click-on-website-trick-with-code\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.vishmax.com\/en\/labs\/disable-text-selection-and-right-click-on-website-trick-with-code\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/www.vishmax.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Disable text selection and right click on website &#8211; trick with code\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.vishmax.com\/en\/#website\",\"url\":\"http:\/\/www.vishmax.com\/en\/\",\"name\":\"Vishmax.com\",\"description\":\"Software Company in Calicut for Web Design and eCommerce\",\"publisher\":{\"@id\":\"http:\/\/www.vishmax.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.vishmax.com\/en\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"http:\/\/www.vishmax.com\/en\/#organization\",\"name\":\"Vishmax.com\",\"url\":\"http:\/\/www.vishmax.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/www.vishmax.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.vishmax.com\/en\/wp-content\/uploads\/2023\/03\/logo-vishmax.png\",\"contentUrl\":\"https:\/\/www.vishmax.com\/en\/wp-content\/uploads\/2023\/03\/logo-vishmax.png\",\"width\":150,\"height\":50,\"caption\":\"Vishmax.com\"},\"image\":{\"@id\":\"http:\/\/www.vishmax.com\/en\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"http:\/\/www.vishmax.com\/en\/#\/schema\/person\/785fa94b56eb17ae7706d30777d6ab93\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/www.vishmax.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e218268870406c917d20b442936d9e68?s=96&d=monsterid&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e218268870406c917d20b442936d9e68?s=96&d=monsterid&r=g\",\"caption\":\"admin\"},\"url\":\"https:\/\/www.vishmax.com\/en\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Disable text selection and right click on website - trick with code - Vishmax.com","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vishmax.com\/en\/labs\/disable-text-selection-and-right-click-on-website-trick-with-code\/","og_locale":"en_US","og_type":"article","og_title":"Disable text selection and right click on website - trick with code - Vishmax.com","og_description":"This post explains how to protect a webpage from copying pages contents including text and image. Its is not possible to protect 100% but we can make it harder to copy contents from a webpage. In order to block the right-click activity we need to use JavaScript which is one of the best scripting languages [&hellip;]","og_url":"https:\/\/www.vishmax.com\/en\/labs\/disable-text-selection-and-right-click-on-website-trick-with-code\/","og_site_name":"Vishmax.com","article_published_time":"2015-08-10T05:42:33+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.vishmax.com\/en\/labs\/disable-text-selection-and-right-click-on-website-trick-with-code\/#article","isPartOf":{"@id":"https:\/\/www.vishmax.com\/en\/labs\/disable-text-selection-and-right-click-on-website-trick-with-code\/"},"author":{"name":"admin","@id":"http:\/\/www.vishmax.com\/en\/#\/schema\/person\/785fa94b56eb17ae7706d30777d6ab93"},"headline":"Disable text selection and right click on website &#8211; trick with code","datePublished":"2015-08-10T05:42:33+00:00","dateModified":"2015-08-10T05:42:33+00:00","mainEntityOfPage":{"@id":"https:\/\/www.vishmax.com\/en\/labs\/disable-text-selection-and-right-click-on-website-trick-with-code\/"},"wordCount":135,"publisher":{"@id":"http:\/\/www.vishmax.com\/en\/#organization"},"keywords":["CSS","jQuery"],"articleSection":["Labs"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.vishmax.com\/en\/labs\/disable-text-selection-and-right-click-on-website-trick-with-code\/","url":"https:\/\/www.vishmax.com\/en\/labs\/disable-text-selection-and-right-click-on-website-trick-with-code\/","name":"Disable text selection and right click on website - trick with code - Vishmax.com","isPartOf":{"@id":"http:\/\/www.vishmax.com\/en\/#website"},"datePublished":"2015-08-10T05:42:33+00:00","dateModified":"2015-08-10T05:42:33+00:00","breadcrumb":{"@id":"https:\/\/www.vishmax.com\/en\/labs\/disable-text-selection-and-right-click-on-website-trick-with-code\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vishmax.com\/en\/labs\/disable-text-selection-and-right-click-on-website-trick-with-code\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.vishmax.com\/en\/labs\/disable-text-selection-and-right-click-on-website-trick-with-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.vishmax.com\/en\/"},{"@type":"ListItem","position":2,"name":"Disable text selection and right click on website &#8211; trick with code"}]},{"@type":"WebSite","@id":"http:\/\/www.vishmax.com\/en\/#website","url":"http:\/\/www.vishmax.com\/en\/","name":"Vishmax.com","description":"Software Company in Calicut for Web Design and eCommerce","publisher":{"@id":"http:\/\/www.vishmax.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.vishmax.com\/en\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"http:\/\/www.vishmax.com\/en\/#organization","name":"Vishmax.com","url":"http:\/\/www.vishmax.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.vishmax.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/www.vishmax.com\/en\/wp-content\/uploads\/2023\/03\/logo-vishmax.png","contentUrl":"https:\/\/www.vishmax.com\/en\/wp-content\/uploads\/2023\/03\/logo-vishmax.png","width":150,"height":50,"caption":"Vishmax.com"},"image":{"@id":"http:\/\/www.vishmax.com\/en\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"http:\/\/www.vishmax.com\/en\/#\/schema\/person\/785fa94b56eb17ae7706d30777d6ab93","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.vishmax.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e218268870406c917d20b442936d9e68?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e218268870406c917d20b442936d9e68?s=96&d=monsterid&r=g","caption":"admin"},"url":"https:\/\/www.vishmax.com\/en\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/posts\/2719"}],"collection":[{"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/comments?post=2719"}],"version-history":[{"count":0,"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/posts\/2719\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/media?parent=2719"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/categories?post=2719"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/tags?post=2719"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}