Game stolen? This could help you!

  • 14 favourites


1,668 visits, 2,237 views



This tutorial hasn't been translated.


This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

[this works also with iframed games!]

Have your games ever been "stolen"?

I've published some games on Kongregate and on some other similar websites.

After a while, searching for one of my games on google, I've discovered that some "freegames" websites were showing my game as their!

For one of those websites was easy to contact the admin and he kindly linked the game to my Kongregate page removing his iframe. But some chinese website didn't want to take it down.

Even changing the game location on my server wasn't useful because they monitor every Kongregate game's change to copy the correct iframe link.

What can we do about this?

If you want your game to be playable only on some websites just add the following lines to your "index.html"

        			var d = document.referrer;var b = '';
        			if(d!=b) = b; 

Code explanation:

When the page is loaded save the url of the current page into the variable "d", save into "b" what the url should be like and if the url of the current page is not the expected url then redirect to the expected url.

Where should I put it?

I usually put this snippet here (inside "index.html"):

Live Example

(maybe one of your games is here too!)

- chinese website (game stealer)


This is not the most secure way to protect your games...but is something!

You can add more websites on your "whitelist":

            		var d = document.referrer;
        			var b = '';
        			var c = '';
            		if(d!=b) = b;
            		else if(d!=c) = c;

You could also obfuscate this code to make it nearly unreadable:

        var _0xc099=["\x72\x65\x66\x65\x72\x72\x65\x72","\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x79\x6F\x75\x72\x77\x65\x62\x73\x69\x74\x65\x2E\x66\x6F\x6F","\x68\x72\x65\x66","\x6C\x6F\x63\x61\x74\x69\x6F\x6E","\x74\x6F\x70","\x72\x65\x61\x64\x79"];$(document)[_0xc099[5]](function (){var _0x6874x1=document[_0xc099[0]];var _0x6874x2=_0xc099[1];if(_0x6874x1!=_0x6874x2){window[_0xc099[4]][_0xc099[3]][_0xc099[2]]=_0x6874x2;} ;} );

You can find Javascript obfuscators online just searching on google.

I've used this one.

Feel free to ask if you need anything!


  • Order by
Want to leave a comment? Login or Register an account!