1
Hit me a recent doubt, where the click
of left button mouse could in a specific case become the right, and vice versa.
Code
var menulist = document.oncontextmenu;
var menu = function(ev) {
if (ev.button == 0 || ev.button == 1) {
menulist = new Function("return true;");
alert('Esquerdo');
} else {
if (ev.button == 2 || ev.button == 3) {
alert('Direito');
}
}
}
document.onclick = menu;
document.oncontextmenu = new Function("return false;");
What I really want with this is set the right button as the first, to apply over a link that contains a file to download. Instead of firing a warning for the user to use the right click for Save Link As....
Of course, it would be ideal just to play oncontextmenu
of right click to the left button when over the link to which it was specified. Then the right click, loses his action at this given moment.
Summary - "I want to know how to apply internal Javascript behaviors to call the
oncontextmenu
in theonclick
."
If you want the user to download because you don’t use the "download" attribute in the link, wouldn’t it be easier? Example: http://answall.com/a/100332/15089
– Inkeliz
@Inkeliz I’ve done method testing
download
, but even so the video opened inside the browser, IE, it was downloaded into the native player of the browser and did not display the window for the download.– Diego Henrique