• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Possible to hide Javascript and other scripting code from users ?

 
margaret gillon
Ranch Hand
Posts: 335
6
Linux Tomcat Server Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am just starting to read the Manning book "Single Page Web Applications" by Michael S. Mikowski and Josh C. Powell and it got me curious.

On pages that use Javascript and/or other scripting languages is there a way to hide the code and functions so end users cannot see it or copy it by downloading the pages ?

I am thinking of applications that might have business logic and rules in the pages that a company would not want competitors to see however competitors would not be blocked from viewing or using the web site. Or the case where someone has developed a game in Javascript and doesn't want other people to copy the game logic.

I am guessing the answer is NO but wanted to check anyway.


 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are correct.

You can minify and obfuscate the code; but you cannot hide it.
 
Edson Cezar
Ranch Hand
Posts: 115
2
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is not possible to hide 100% your code, because it is processed directly in browser, however is possible obfuscate your code.

See this link:

Online Javascript compressor

I believe this is an interesting way
 
Rob Crowther
author
Ranch Hand
Posts: 297
5
Android Fedora Firefox Browser
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
margaret gillon wrote:cannot see it or copy it by downloading the pages ?


If the browser can't download the code then the browser can't execute the code, so you can't do this without disabling your own application. In the general case, a company's business logic isn't half as unique and special as the company thinks it is.

Edson Cezar wrote:however is possible obfuscate your code


Meet the de-obfuscator.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indeed, be aware that even in the face of minification and obfuscation anyone who really wants to see your code is going to.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic