Loading

Protect your Website Content – Text & Images

Post Content
Protect your Website Content

How to Protect your Website Content?

Protect your Website Content using some javaScript codes pasting them into your website main js file. These codes contain protection of your text content and your website images.

The code you will need to protect your text content:

function protect_text_content() {
var omitformtags=["input", "textarea", "select"]
omitformtags=omitformtags.join("|")
function disableselect(e){
if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
return false
}
function reEnable(){
return true
}
if (typeof document.onselectstart!="undefined")
document.onselectstart=new Function ("return false")
else {
document.onmousedown=disableselect
document.onmouseup=reEnable
}
}
protect_text_content();

The code you will need to protect your website images:

function protect_image_content() {
document.addEventListener("contextmenu",kpg_nrci_cm, false);
document.addEventListener("dragstart",kpg_nrci_cm, false);
document.addEventListener("touchmove",kpg_nrci_cm, false);
document.addEventListener("touchstart",kpg_nrci_cm, false);
document.addEventListener("gesturestart",kpg_nrci_cm, false);
function kpg_nrci_block(event) {
event.cancelBubble = true;
if(event.preventDefault != undefined) {
event.preventDefault();
}
if(event.stopPropagation != undefined) {
event.stopPropagation();
}
return false;
}
function kpg_nrci_cm(event) {
try {
if (event.target.tagName == "IMG") {
event.cancelBubble = true;
if(event.preventDefault != undefined) {
event.preventDefault();
}
if(event.stopPropagation != undefined) {
event.stopPropagation();
}
return false;
}
} catch(error) {
console.log("NRI error:"+error);
}

try {
if(event.target.getAttribute("style")==null ||
event.target.getAttribute("style")=="") {
return true;
}
if (event.target.style.backgroundImage != null
&& event.target.style.backgroundImage != 'none'
&& event.target.style.backgroundImage != '') {
event.cancelBubble = true;
if(event.preventDefault != undefined) {
event.preventDefault();
}
if(event.stopPropagation != undefined) {
event.stopPropagation();
}
return false;
}
} catch(error) {
console.log("NRI error:"+error);
}
return true;
}
}
protect_image_content();

After you type these codes into your website javascript file, no visitor can copy your text content or save your website images.

Get these codes now by downloading it using the below link:

Click Here to Protect your Website Content

Write a comment

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.