{"id":116,"date":"2006-12-18T00:26:00","date_gmt":"2006-12-18T00:26:00","guid":{"rendered":"https:\/\/wdev-blog.azurewebsites.net\/index.php\/2006\/12\/18\/disabling-the-browser-context-menu\/"},"modified":"2006-12-18T00:26:00","modified_gmt":"2006-12-18T00:26:00","slug":"disabling-the-browser-context-menu","status":"publish","type":"post","link":"http:\/\/panahy.nl\/index.php\/2006\/12\/18\/disabling-the-browser-context-menu\/","title":{"rendered":"Disabling the Browser Context Menu"},"content":{"rendered":"<div>\n<div>Date: Monday, 18 Dec 2006 14:14<\/div>\n<div> <\/div>\n<\/div>\n<div>Origin : <a href=\"http:\/\/ajaxcookbook.org\/disable-browser-context-menu\/\"><span style=\"color:#810081;\">http:\/\/ajaxcookbook.org\/disable-browser-context-menu\/<\/span><\/a><\/div>\n<div>By <a href=\"http:\/\/finiteloop.org\/~btaylor\/\">Bret Taylor<\/a>, December 3, 2006<\/div>\n<p>You can disable the browser context menu for an element in your DOM with the following JavaScript recipe:<\/p>\n<pre>function disableContextMenu(element)<br \/>{<br \/>     element.oncontextmenu = function()<br \/>      {         return false;     }<br \/>}<\/pre>\n<p>For example, to disable the context menu over a photo on your page, you could use:<\/p>\n<pre>disableContextMenu(document.getElementById(\"photo\"));<\/pre>\n<p>Browsers like Firefox do not always allow web pages to disable the context menu (this option is <a href=\"http:\/\/www.mozilla.org\/support\/firefox\/options#content\">a setting in Firefox<\/a>), so this recipe will not work 100% of the time in all browsers. <\/p>\n<p><a href=\"http:\/\/ajaxcookbook.org\/examples\/contextmenu.html\">See the example<\/a><\/p>\n<p><img loading=\"lazy\" height=\"1\" src=\"http:\/\/blogs.wdevs.com\/a.Panahy\/aggbug\/19224.aspx\" width=\"1\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Date: Monday, 18 Dec 2006 14:14 Origin : http:\/\/ajaxcookbook.org\/disable-browser-context-menu\/ By Bret Taylor, December 3, 2006 You can disable the browser context menu for an element in your DOM with the following JavaScript recipe: function disableContextMenu(element){ element.oncontextmenu = function() { return false; }} For example, to disable the context menu over a photo on your page, &hellip; <a href=\"http:\/\/panahy.nl\/index.php\/2006\/12\/18\/disabling-the-browser-context-menu\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Disabling the Browser Context Menu&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[28,18],"tags":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"post-thumbnail":false},"uagb_author_info":{"display_name":"Pouya Panahy","author_link":"http:\/\/panahy.nl\/index.php\/author\/pouya\/"},"uagb_comment_info":0,"uagb_excerpt":"Date: Monday, 18 Dec 2006 14:14 Origin : http:\/\/ajaxcookbook.org\/disable-browser-context-menu\/ By Bret Taylor, December 3, 2006 You can disable the browser context menu for an element in your DOM with the following JavaScript recipe: function disableContextMenu(element){ element.oncontextmenu = function() { return false; }} For example, to disable the context menu over a photo on your page,&hellip;","_links":{"self":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts\/116"}],"collection":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/comments?post=116"}],"version-history":[{"count":0,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts\/116\/revisions"}],"wp:attachment":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/media?parent=116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/categories?post=116"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/tags?post=116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}