AD Banner

Featured

3/featured/recent

footer about

Videos

6/cate2/videos
Adv (300 x 250)

Find us on Facebook

5/cate3/lifestyle

Advertisement

6/breakingnews/random

Instagram posts

About us

3/cate1/entertainment

Recent Comments

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
Copyright ©2019 by Mogtemplates

contact form

Name

Email *

Message *

Other News

[Related][recentmag]

EHI ONLINE LESSONS

EHI ONLINE LESSONS

Powered by Blogger.

Random Posts

World News

[World News][recentmag]
featured

Header Ads

Total Pageviews

Search This Blog

Blog Archive

Search This Blog

Latest

Brexit

Brexit

Football

Football

Random posts

5/cate4/random

Random Post

Adv (880 x 120)

News By Picture

pictures

Hot News

5/cate3/hottrend
Adv (880 x 120)

Labels

Hot News

[Hot News][recentmag]

Labels Cloud

Get In Touch
Footer Logo

Trending Posts Display

Labels List

Home Layout Display

Posts Title Display

Theme Layout

Theme Translation

Tech

tech

Games

games

Popular Posts

127 Likes
3,240 Followers
12.7k Subscribers
136 Followers

Pages

Recent Comments

How accessories make you a better lover. 18 ways devices are completely overrated. Operating systems in 12 easy steps.

Recent Posts

Adv (300 x 250)

Popular Posts

Trending Posts

3 Methods To Disable Right Click On A WebPage – CSS, Javascript and HTML

By Ehijoshua (Jboss) → Tuesday, 29 April 2014

3 Methods To Disable Right Click On A WebPage – CSS, Javascript and HTML


There’s no doubt that since the inception of the internet, the fight against content theft has always been on the increase as content thieves are always on the rise.
how to disable right click
In this short tutorial, I’ll be guiding you through a set of ways you can easily disable right click on your website, blog or webpage using any of the methods below.
Before we continue, one thing you should bear in mind is that disabling right click can be useful in some websites and become useless for others. For instance, disabling right click on this blog
would do more harm than good as many people won’t be able to copy various codes I’ve given out here. So use this function wisely.
Below, you’ll learn how to disable right click using JavaScript, CSS and HTML body tag

Disabling Right Click Using HTML Body Tag

After you must have designed a webpage let’s say using DreamWeaver, it is very much easy to disable right click by means of adding oncontextmenu handler in body tag of webpage.
When you view the source code of your newly designed webpage, search for <body>, add the oncontextmenu handler to it as
<body oncontextmenu=”return false;” >
Then Save. It works like charm, your content would be more secured as right click would be disabled.

Disabling Right Click Using CSS

This is another pretty easy method you can use in disabling right click. One thing I like about this method is that people barely know that CSS can disable text selection and might not be able to find ways to outsmart this method unlike the Javascript method. Here we will be making use of the user-select CSS property to disable right click in any selected CSS class region of your choice. In this method, I’m assuming that the CSS region you wish to disable right click is specified as a body CSS class (.body). Below is the CSS snippet to add to your CSS code to disable right click.

.body {
-webkit-user-select: none;  /* Chrome all / Safari all */
-moz-user-select: none;     /* Firefox all */
-ms-user-select: none;      /* IE 10+ */
-o-user-select: none;
user-select: none;
}

Add it to your site’s CSS file and save. Right click would be disabled in the selected region.

Disabling Right Click Using Javascript

Using Javascript to disable right click is one of the widely used methods around the web. I actually don’t prefer this method as content thieves can easily outsmart this method by disablpng Javascript on their web browsers. Below is a link to a former tutorial I made on how to disable right click using JavaScript.
I hope you find this guide useful. Feel free to let us know any problems you encountered using the comment box below.
Jillur Rahman

I'm Jillur Rahman. A full time web designer. I enjoy to make modern template. I love create blogger template and write about web design, blogger. Now I'm working with Themeforest. You can buy our templates from Themeforest.

No Comment to " 3 Methods To Disable Right Click On A WebPage – CSS, Javascript and HTML "