{"id":845,"date":"2011-06-07T10:32:22","date_gmt":"2011-06-07T14:32:22","guid":{"rendered":"http:\/\/www.iowawebnet.com\/ein\/?p=845"},"modified":"2011-06-07T10:35:32","modified_gmt":"2011-06-07T14:35:32","slug":"block-access-to-page-context-menu","status":"publish","type":"post","link":"https:\/\/www.iowawebnet.com\/ein\/2011\/06\/block-access-to-page-context-menu\/","title":{"rendered":"Block Access To Page Context Menu"},"content":{"rendered":"<p>By <em>Stephen Chapman<\/em><\/p>\n<p>Web novices often believe that by blocking their             visitors use of the right mouse button that they can             prevent the theft of their web page content. Nothing             could be further from the truth as there are so many             ways to bypass the &#8220;no right click script&#8221;             that the only effects that such a script has is to             annoy those of your visitors who legitimately use the             context menu (as that menu is properly called) in their             web navigation.<\/p>\n<p>Additionally, all of the scripts that I have seen to do             this only block access to the context menu from the             right muse button. They don&#8217;t consider the fact             that the menu is also accessible from the keyboard. All             anyone needs to do to access the menu using a 104 key             keyboard is to select the object on the screen that             they want to access the context menu for (for example             by left clicking on it) and then press the context menu             key on their keyboard (it&#8217;s the one immediately to             the left of the right CTRL key) or on a 101 key             keyboard hold down the shift key and press F10 to             achieve the same effect.<\/p>\n<p>Well here&#8217;s a really simple script that you can use             to block all access to the context menu (not just from             the right mouse button but from the keyboard as well)             and really annoy your visitors. The script is even             simpler than most of the ones that only block the mouse             button and works in about as many browsers as those             scripts do. Here&#8217;s the entire script for you.<\/p>\n<p><a rel=\"attachment wp-att-840\" href=\"http:\/\/www.iowawebnet.com\/ein\/?attachment_id=840\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-840\" title=\"ScreenShot031\" src=\"http:\/\/www.iowawebnet.com\/ein\/wp-content\/uploads\/2011\/04\/ScreenShot031.gif\" alt=\"\" width=\"420\" height=\"40\" srcset=\"https:\/\/www.iowawebnet.com\/ein\/wp-content\/uploads\/2011\/04\/ScreenShot031.gif 420w, https:\/\/www.iowawebnet.com\/ein\/wp-content\/uploads\/2011\/04\/ScreenShot031-300x28.gif 300w\" sizes=\"(max-width: 420px) 100vw, 420px\" \/><\/a><\/p>\n<p>Adding just that small piece of code to the body tag of             your web page is more effective at blocking your             visitor&#8217;s access to the context menu than the many             no right click scripts that you can find elsewhere on             the web because it blocks access from both the mouse             button and the keyboard options described above.<\/p>\n<p>Of course the script doesn&#8217;t work in all web             browsers (eg Opera ignores it &#8211; but then Opera ignores             all of the no right click scripts as well). It also             does nothing to prevent your visitors from accessing             the page source using the <strong>View Source<\/strong> option             from their browser menu, from saving the web page and             viewing the source of the saved copy in their favourite             editor, or from using a <a href=\"http:\/\/javascript.about.com\/library\/blsource.htm\" target=\"_blank\">View             Source Bookmarklet<\/a>.<\/p>\n<p>Also, when the context menu has been disabled like this             it can be easily re-enabled by typing             <strong>javascript:void oncontextmenu(null)<\/strong> into the             address bar of the browser.<\/p>\n<p>Article original link: <a href=\"http:\/\/javascript.about.com\/library\/blnoright.htm\" target=\"_blank\">http:\/\/javascript.about.com\/library\/blnoright.htm<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>By Stephen Chapman Web novices often believe that by blocking their visitors use of the right mouse button that they can prevent the theft of their web page content. Nothing could be further from the truth as there are so many ways to bypass the &#8220;no right click script&#8221; that the only effects that such [&hellip;]<\/p>\n","protected":false},"author":35,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,50,16,33,43],"tags":[19,143,37],"class_list":["post-845","post","type-post","status-publish","format-standard","hentry","category-applications","category-articles","category-net","category-classic-asp","category-javascript-2","tag-asp-net","tag-html","tag-javascript"],"_links":{"self":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/845"}],"collection":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/users\/35"}],"replies":[{"embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/comments?post=845"}],"version-history":[{"count":7,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/845\/revisions"}],"predecessor-version":[{"id":854,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/posts\/845\/revisions\/854"}],"wp:attachment":[{"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/media?parent=845"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/categories?post=845"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.iowawebnet.com\/ein\/wp-json\/wp\/v2\/tags?post=845"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}