-1

What should I do to protect my code?

Due to the open source code, a person can take the data, one by one. Alternatively, they save press ctrl+s. I want to protect it so that if someone wants to take my data, he has to connect to my site.

Tunaki
  • 132,869
  • 46
  • 340
  • 423

3 Answers3

1

This is a classical caveat of serving client-side code. It is impossible to completely hide your code if you are going to send it to a client; he must receive a .js file in order to execute it in his browser, and that file is always viewable by some means.

You can attempt to obfuscate your code using a minifier like Uglify.js, but people can still prettify your code and examine it and attempt to figure out how it works.

Alternatively you could do everything server-side and serve images of the game to the user, but this would be impractical for any game with a moderately-high framerate.

Note that in most countries you have a copyright on whatever you write, so if someone was to ever steal your code you could sue them.

Jackson
  • 9,188
  • 6
  • 52
  • 77
  • Like this site http://mudcu.be/sketchpad/ or http://rumpetroll.com/ . If someone takes the code. So, he must connect the connection with the site. So, thieves can not retrieve its data or could not be accessed.Without a connection to the original site – user3547311 Apr 19 '14 at 03:45
  • Rumpetroll actually has a GitHub page. They don't seem bothered at all by the idea of someone else seeing or even using their code. – Jackson Apr 19 '14 at 04:01
  • I suppose theoretically either of those pages *could* have generated their images server-side and fed them to the client in real time, but like I said this would be incredibly slow and impractical. – Jackson Apr 19 '14 at 04:02
  • What if this site http://mudcu.be/sketchpad ? I tried to steal the data still can not. Although existing javascript. But that can not be done is take pictures. How did that happen? – user3547311 Apr 19 '14 at 04:11
  • It looks like their GUI code is in an inline script tag in the page head. Technically not a .js file, but still viewable. – Jackson Apr 19 '14 at 04:12
  • 1
    And just FYI, no client-side code has ever been *completely* hidden. Even compiled C code can be deciphered by examining the output assembly code. You should worry less about hiding your code and more about developing valuable products and services. – Jackson Apr 19 '14 at 04:15
  • How can I do that? Are you able to provide an easy learning? Or keywords to find digoogle?cause my sites http://khaerinisa.tk Not to be. I'm afraid if it is so, there is imitate – user3547311 Apr 19 '14 at 04:19
  • I mean http://khaerinisa.tk/infdex.html – user3547311 Apr 19 '14 at 04:34
0

You can't protect your javascript functionality from copy-paste, as explained here.

How to protect code in HTML5/Canvas game?

Community
  • 1
  • 1
gumenimeda
  • 815
  • 7
  • 15
  • 43
  • Like this site http://mudcu.be/sketchpad/ or http://rumpetroll.com/ . If someone takes the code. So, he must connect the connection with the site. So, thieves can not retrieve its data or could not be accessed.Without a connection to the original site – user3547311 Apr 19 '14 at 03:45
  • If you open developer tools(F12) in Chrome and reload the website you will see all Javascript(both websites that you included in your comment). I am not sure what you are referring when saying "So, thieves can not retrieve its data or could not be accessed.Without a connection to the original site" – gumenimeda Apr 19 '14 at 03:55
  • I'm not shield javascriptnya. But if one is taking data, then it should connect to my site. You understand? – user3547311 Apr 19 '14 at 04:00
0

To paraphrase the Borg..."obfuscation is futile"

(your code and your data must become visible for the browser to run it)

To slow thieves down:

If you're trying to protect your methods: minify your javascript.

If you're trying to protect your data: download data from server in real time (Ajax/websockets).

markE
  • 102,905
  • 11
  • 164
  • 176
  • Like this site http://mudcu.be/sketchpad/ or http://rumpetroll.com/ . If someone takes the code. So, he must connect the connection with the site. So, thieves can not retrieve its data or could not be accessed.Without a connection to the original site – user3547311 Apr 19 '14 at 03:46
  • Not possible my friend! Minify: http://refresh-sf.com/yui/ **But a smart thief can still steal your code** – markE Apr 19 '14 at 04:37