I want to edit the right click of Chrome and add a shortcut to send to a number on Whatsapp. I already have an app that modified the menu to be able to call from a Samsung phone. I'm looking for a way to add more buttons
I'm not looking for a way to do it from my website or Chrome extension. There is a similar question that does not relate to my problem here: Adding to browser context menu?. It does not solve my problem, I'm looking for a way to edit the entire Chrome right click menu, the same way that the "Call from Samsung Phone" option is being populated.
When developing a Chrome extension, you can interact with and add items to the context menu.
More information in the documentation
you can create your own right click, with all the buttons and actions you want. first you listen to the this event:
contextmenu
then you create your own menu with html and css. if you need a full example, this is a vanilla js example by ryanmorr:
var menu = document.querySelector('.menu');
function showMenu(x, y){
menu.style.left = x + 'px';
menu.style.top = y + 'px';
menu.classList.add('menu-show');
}
function hideMenu(){
menu.classList.remove('menu-show');
}
function onContextMenu(e){
e.preventDefault();
showMenu(e.pageX, e.pageY);
document.addEventListener('mousedown', onMouseDown, false);
}
function onMouseDown(e){
hideMenu();
document.removeEventListener('mousedown', onMouseDown);
}
document.addEventListener('contextmenu', onContextMenu, false);
to see the full code visit: https://codepen.io/ryanmorr/pen/JdOvYR