aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Possible to hide Javascript and other scripting code from users ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Possible to hide Javascript and other scripting code from users ?" Watch "Possible to hide Javascript and other scripting code from users ?" New topic
Author

Possible to hide Javascript and other scripting code from users ?

margaret gillon
Ranch Hand

Joined: Nov 12, 2008
Posts: 318
    
    6

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

Joined: Jan 10, 2002
Posts: 61769
    
  67

You are correct.

You can minify and obfuscate the code; but you cannot hide it.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Edson Cezar
Ranch Hand

Joined: Mar 05, 2011
Posts: 75
    
    1
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

Joined: Nov 06, 2012
Posts: 297
    
    5

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.


Read my books: Hello! HTML5 & CSS3 | HTML5 in Action | Read my blog
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61769
    
  67

Indeed, be aware that even in the face of minification and obfuscation anyone who really wants to see your code is going to.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Possible to hide Javascript and other scripting code from users ?