• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Possible to hide Javascript and other scripting code from users ?

 
Ranch Hand
Posts: 339
7
Tomcat Server Ubuntu Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.


 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are correct.

You can minify and obfuscate the code; but you cannot hide it.
 
Ranch Hand
Posts: 119
2
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 297
5
Android Firefox Browser Fedora
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic