Learn how to disable right click with JavaScript

Do you want your visitors not to right click on the page they visits? If yes then check out the snippet given in this article.

<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">html</span><span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">&lt;</span><span style="color: #800000">head</span><span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">&lt;</span><span style="color: #800000">script</span> <span style="color: #ff0000">language</span> = <span style="color: #0000ff">&quot;javascript&quot;</span><span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">function</span> Disable() {
<span style="color: #0000ff">if</span> (event.button == 2) 
{
<span style="color: #0000ff">alert</span>(&quot;<span style="color: #8b0000">This action is not possible</span>&quot;)
}
}
<span style="color: #0000ff">document</span>.onmousedown=Disable;
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">script</span><span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">head</span><span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">&lt;</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">html</span><span style="color: #0000ff">&gt;</span>
READ  Printing using JavaScript

4 Responses to "Learn how to disable right click with JavaScript"

  1. Amber Phillips   July 29, 2010 at 12:46 pm

    are there any good seo forum which discusses more about keyword research?*’~

    Reply
  2. Colton Diaz   September 27, 2010 at 11:12 pm

    the best SEO forum that i know is none other than digitalpoint-~,

    Reply
  3. Tera Goreczny   September 6, 2011 at 4:05 am

    Excellent read, I just passed this onto a colleague who was doing some research on that. And he just bought me lunch since I found it for him smile Therefore let me rephrase that: Thank you for lunch!

    Reply
  4. Anthony   September 7, 2011 at 2:29 pm

    Hey there, You’ve done an admirable job. I should surely digg it and I’ll recommend to my buddies. Most likely they’ll be taken advantage of this great site.

    Reply

Leave a Reply

Your email address will not be published.