Javascript protection from site cloning

I will here show a tiny bit of javascript that can help you if implemented AFTER you’ve been cloned, mostly used in cases when your ranks and traffic has fallen down so much that you’re trying to save what can be saved, and get a portion of your traffic back from the clone.

Both of the javascripts I’ll be listing are, simply said, checking if your site really is your site and then doing a redirect to your original site.

Javascript cloning protection version one

This piece of javascript needs to be put in a separate .js javascript file and hosted remotely (on some other website). Give it some name, example hello-hacker.js

/* Redirect the person as an example. */

Upload it to other site and add it to your site, somewhere between <head> and </head> tags in the code. Like this:

<script src=””></script>


Javascript cloning protection version two

This piece of script is identical to previous one, but as you can see from the code, it combines your domain name from two factors, so that your domain name can’t be spoofed automatically by the clone site. You can include this javascript directly in your website.

if(window.location.href.indexOf("yourd"+"") < 0) {

 This will not help much

I’m not writing too much detail in this article because it doesn’t make much sense, as this method is pretty much worthless. So to say, this is like nursing the symptoms, without finding the cure to the disease itself. Another problem with this javascript is that hackers can block your javascript from the clone in a minute, and simply keep cloning your site without any issue.

I will cover the clone website shutdown in my next post.

Leave a Reply