/    Sign up×
Community /Pin to ProfileBookmark

Does anybody know the code to stop people from right clicking on my site?

Does anybody know the code to stop people from right clicking on my site??

to post a comment
Full-stack Developer

3 Comments(s)

Copy linkTweet thisAlerts:
@FlyByProgrammerAug 11.2003 — Here's the code to stop right click:

<i>
</i>&lt;html&gt;
&lt;head&gt;
&lt;script type="text/javascript"&gt;
function disable()
{
if (event.button == 2)
{
alert("Sorry no rightclick on this page.nYou cannot view my sourcenand you cannot steal my images.")
}
}

&lt;/script&gt;
&lt;/head&gt;
&lt;body onmousedown="disable()"&gt;

&lt;/body&gt;
&lt;/html&gt;



It is taken from http://www.w3schools.com/
Copy linkTweet thisAlerts:
@Robert_WellockAug 11.2003 — Close this topic quick because if I disable JavaScript on my browser the above fails…
Copy linkTweet thisAlerts:
@brendandonhueAug 11.2003 — Search the forums...this has been discussed dozens of times. In the end, just about any method of stopping right clicks or protecting your client-side source code will backfire or can be gotten around with 2 minutes of effort.
×

Success!

Help @crazymicegirl 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.17,
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,
)...