/    Sign up×
Community /Pin to ProfileBookmark

How 2 deactivate right click

Hi y’all JS gurues!
Is it possible …? to deactivate the right-click event on a link?

that’s all.

Kind regards

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@jrbpOct 11.2003 — This is how you can get right click disabled for th whole page:<script language=JavaScript>

<!--

//Disable right mouse click Script

//By Maximus ([email protected]) w/ mods by DynamicDrive

//For full source code, visit http://www.dynamicdrive.com

var message="Function Disabled!";

///////////////////////////////////

function clickIE4(){

if (event.button==2){

alert(message);

return false;

}

}

function clickNS4(e){

if (document.layers||document.getElementById&&!document.all){

if (e.which==2||e.which==3){

alert(message);

return false;

}

}

}

if (document.layers){

document.captureEvents(Event.MOUSEDOWN);

document.onmousedown=clickNS4;

}

else if (document.all&&!document.getElementById){

document.onmousedown=clickIE4;

}

document.oncontextmenu=new Function("alert(message);return false")

// -->

</script>


from: http://www.dynamicdrive.com/dynamicindex9/noright.htm
Copy linkTweet thisAlerts:
@CalibanauthorOct 11.2003 — Thanx,

it works fine as is.

I only had to translate the message text (from english to spanish) and voilá ?

by the way, this is the first post about this issue ... i suppose :rolleyes:

kind regards.
×

Success!

Help @Caliban spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...