License your game to domain(s), protect your games.

2
  • 15 favourites

Stats

1,519 visits, 2,104 views

Translations

This tutorial hasn't been translated.

Tools

License

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.

License your game to domain(s), protect your games.

Notice this isn't 100% protective but offers a good solution.

1. Export your game (HTML5).

2. Open index.html file in editor (notepad++)

3. Find <body> tag.

4. Copy and paste under <body> tag:

    var referrer = document.domain; // The result of referrer will be: www.domain.com
    if(referrer == "www.yourdomain.com"){ 
     // Use || for multiple domains like : if(referrer == "www.yourdomain.com" || "www.seconddomain.com"){ 
    window.myValue = true;
    }else{
    document.write("Access denied");
    window.myValue = false;
    }


5. When you are done setting up the domains go to : javascriptobfuscator.com/Javascript-Obfuscator.aspx[/b]

6. Paste your code & click the obfuscate button:

7. Copy everything and change it with your current code under <body>

Like :

    	<script>
    var _0x5217=["\x64\x6F\x6D\x61\x69\x6E","\x77\x77\x77\x2E\x79\x6F\x75\x72\x64\x6F\x6D\x61\x69\x6E\x2E\x63\x6F\x6D","\x6D\x79\x56\x61\x6C\x75\x65","\x41\x63\x63\x65\x73\x73\x20\x64\x65\x6E\x69\x65\x64","\x77\x72\x69\x74\x65"];var referrer=document[_0x5217[0]];if(referrer==_0x5217[1]){window[_0x5217[2]]=true}else {document[_0x5217[4]](_0x5217[3]);window[_0x5217[2]]=false;};
    	</script>

8. Find <script src="c2runtime.js"></script>

9. Replace it with :

    	<script>
    var _$_4a06=["\x6D\x79\x56\x61\x6C\x75\x65","\x3C\x73\x63\x72\x69\x70\x74\x20\x73\x72\x63\x3D\x22\x63\x32\x72\x75\x6E\x74\x69\x6D\x65\x2E\x6A\x73\x22\x3E\x3C\x2F\x73\x63\x72\x69\x70\x74\x3E","\x77\x72\x69\x74\x65"];if(window[_$_4a06[0]]==true){var _0xe376=[_$_4a06[1],_$_4a06[2]];document[_0xe376[1]](_0xe376[0]);};</script>

10. Save your index.html & control if it's working

Don't forget to post feedback : )

For geeks after you did the process above

If you want to make it really hard for people to steal & use your games use :

JS obfuscators:

-

http://yui.github.io/yuicompressor/

-

https://jscrambler.com/en/

-

http://closure-compiler.appspot.com/home

-

http://marijnhaverbeke.nl/uglifyjs

  • 0 Comments

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