Menu bar

Saturday 5 July 2014

How to disable right click , F12 key and Direct link access?

Stop users from stealing your website images, copying content, or from inspecting the source.

In order to setup a security as above , the first is to disable right click ,disable F12 key and then disable direct link access.

Direct link access means that a user get full path of image by writing 'view-source:' before the domain name.
After getting the full path, user will type the full path of image in address bar to access images, So we have to avoid this attack also.
Use this code in your header file or where ever you required.

<body oncontextmenu="return false;">
Fires when the user clicks the right mouse button in the client area, opening the context menu.


<meta http-equiv="imagetoolbar" content="no" />
This turns off Internet Explorer's image toolbar that appears when you hover over an image.
Use this code within <head > tag.


RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L]
Write this code in your .htaccess file

No comments: