How to Block Right Clicking with or Without a Message

Put the script (onContextMenu="return false;") right before the > symbol in the HTML tag., Then, try to right click! , If you would like a message to display follow the below steps., Instead of the other script (onContextMenu="return false;") then...

4 Steps 1 min read Easy

Step-by-Step Guide

  1. Step 1: Put the script (onContextMenu="return false;") right before the > symbol in the HTML tag.

    For example, it would look like this: <html onContextMenu="return false;">
  2. Step 2: try to right click!

    , If you are happy you don't have to do anything: , If you want a quote symbol or quote_single symbol, put a forward_slash (/) in front of the quote_single or quote, not the word.

    For example: onContextMenu="alert('Oh no you don\'t!');return false;"
  3. Step 3: If you would like a message to display follow the below steps.

  4. Step 4: Instead of the other script (onContextMenu="return false;") then put in this script ( onContextMenu="alert('YOUR MESSAGE HERE');return false;") instead.

Detailed Guide

For example, it would look like this: <html onContextMenu="return false;">

, If you are happy you don't have to do anything: , If you want a quote symbol or quote_single symbol, put a forward_slash (/) in front of the quote_single or quote, not the word.

For example: onContextMenu="alert('Oh no you don\'t!');return false;"

About the Author

B

Bruce Reyes

A seasoned expert in media and communications, Bruce Reyes combines 1 years of experience with a passion for teaching. Bruce's guides are known for their clarity and practical value.

41 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: