E
E
evgenin2019-09-19 12:11:40
JavaScript
evgenin, 2019-09-19 12:11:40

Right click by default in Chrome?

Tell me what script to make the right click by default in Chrome, now there is a menu dropping out when clicked.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Arushanov, 2019-09-19
@daruwanov

If you need to make your own behavior, then you can like this

window.oncontextmenu = function(e){
 // your code that will add html with your custom menu
e.preventDefault();
}

If, on the contrary, this behavior is already redefined on the resource you are interested in,
then this should help if on a certain element only then
const element = document.getElementById('someId')
element.oncontextmenu = null // || or function (e) { /*code*/ e.preventDefault(); } соответсвенно

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question