You can do that with JavaScript by adding an event listener for the “contextmenu” event and calling the preventDefault()
method:
document.addEventListener('contextmenu', event => event.preventDefault());
That being said: DON’T DO IT.
Why? Because it achieves nothing other than annoying users. Also many browsers have a security option to disallow disabling of the right click (context) menu anyway.
Not sure why you’d want to. If it’s out of some misplaced belief that you can protect your source code or images that way, think again: you can’t.
Related Posts:
- Failed to load resource: the server responded with a status of 404 (Not Found)
- What is NODE_ENV and how to use it in Express?
- How to deal with net::ERR_SSL_PROTOCOL_ERROR?
- What is the way of declaring an array in JavaScript?
- How to disable JavaScript in Chrome Developer Tools?
- Reactjs – Form input validation
- What is event bubbling and capturing?
- What is lexical scope?
- Remove element by id
- Angular: mat-form-field must contain a MatFormFieldControl
- JS – ReferenceError: fetch is not defined
- Check if a variable is a string in JavaScript
- How can I add a key/value pair to a JavaScript object?
- Adding an onclick event to a div element
- Typescript : Property does not exist on type ‘object’
- AngularJS : Factory and Service?
- What’s the difference between console.dir and console.log?
- Left() function in Javascript or jQuery
- Why is “forEach not a function” for this object?
- Completely disable scrolling of webpage
- Express error – TypeError: Router.use() requires middleware function but got a Object
- How to Open New window on every Click
- Jquery Ajax Call, doesn’t call Success or Error
- How to create a stopwatch using JavaScript?
- Use of $parse in angular js
- How to set onClick with JavaScript?
- How does += (plus equal) work?
- Javascript Comparison Operators != vs !==
- onEnter not called in React-Router
- Find the largest palindrome made from the product of two 3-digit numbers – Javascript
- Javascript/Jquery Convert string to array
- How to interpolate variables in strings in JavaScript, without concatenation?
- Difference between “module.exports” and “exports” in the CommonJs Module System
- Local package.json exists, but node_modules missing
- How can I use webpack with express?
- JavaScript check if variable exists (is defined/initialized)
- Embedding instagram webpage inside an iframe
- Do something if screen width is less than 960 px
- How to add a keyboard listener to my onClick handler?
- GulpUglifyError:Unable to minify JavaScript
- Uncaught TypeError: Cannot read property ‘toUpperCase’ of undefined
- why angularjs ng-repeat not working
- jQuery remove options from select
- Convert UTC Epoch to local date
- Javascript – Replace html using innerHTML
- Syntax error: Illegal return statement in JavaScript
- Error: TypeError: $(…).dialog is not a function
- Bootstrap modal – close modal when “call to action” button is clicked
- Javascript: difference between a statement and an expression?
- Keep getting a “Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup” when attempting to google plus login on my web app
- The entity name must immediately follow the ‘&’ in the entity reference
- How can I use goto in Javascript?
- Javascript Function that returns true if a letter?
- How do I know which version of Javascript I’m using?
- getContext is not a function
- lodash multi-column sortBy
- D3.js: what is ‘g’ in .append(“g”) D3.js code?
- Correct modification of state arrays in React.js
- Angular 2 Sort table columns
- JavaScript string encryption and decryption?
- Calling a JavaScript function in another js file
- JavaScript code not running in HTML5 document
- How to dequeue a script?
- How to use wp_localize_script in custom page template?
- Force core to use .dev JavaScript files
- WP Customizer set a value via javascript (to create presets)
- TinyMCE Button to Insert Multiple Lines of Text?
- How to add extra attributes to the script tag added via wp_localize_script()
- preserve url parameters from affliliate sites
- How to overwrite JS variable with wp_localize _script?
- How to get value of selected page template in Gutenberg editor?
- What javascript libs & frameworks are integrated in WordPress vanilla?
- Conditional fields in contact form 7 not working
- How to place script in footer?
- Enqueueing a script and a style sheet not working
- AngularJS with route and JSON API
- Uppload image from another source wp.media
- List of JS Events for Widgets?
- Authentication with the Rest API when using an External Application
- Use onfocus event in Contact Form 7
- Get Block Attributes in JSON REST API
- Open Featured Image Modal in WordPress Gutenberg onClick of a button
- enqueue script won’t work (enqueue style does work)
- Variable equals another variable and then equals another variable
- in jquery read a multidimensional array via wp_localize_script()
- Uncaught ReferenceError: jQuery is not defined – although jQuery is loaded [closed]
- How can I import one custom block into another?
- Custom JS on a specific page
- How to import a JavaScript Library into WordPress
- How to get file object from file_attachment?
- How to change the link address from internal to external
- How do I load urls from an external .js file to my admin head?
- Nothing in dashboard that uses javascript works
- Uncaught TypeError: Cannot read property ‘add’ of undefined bp-plupload.min.js
- Where is the Javascript attribute window._wpCustomHeaderSettings defined?
- How to execute WP shortcode in a javascript string “”
- how to include js in widget?
- JS files landing on page but not working, using childtheme of twentyeleven
- List unused javascript for easy removal
- Replacing & in JS code on pages