-3

I have a site whereby I can currently use firebug to look at all the angularjs files.

Is there anyway I can hide these so people cannot use tools to view them?

tjhack
  • 1,022
  • 3
  • 20
  • 43
  • 7
    No. If the browser can't see the code, it can't execute the code. If the browser can see the code, so can the user. You *can* obscure the code and make it difficult to read. There are obfuscator tools to do that, though often minifying it is enough. – David May 02 '14 at 14:06
  • No. This can't be done, the client needs the files to render the frontend. – Allan Kimmer Jensen May 02 '14 at 14:06
  • If you want to protect your code then look into obfuscators. – Wizard of Ogz May 02 '14 at 14:08
  • Just remember, your code *can* be un-minified and deobfuscated with tools like http://jsbeautifier.org/ – gen_Eric May 02 '14 at 14:28

4 Answers4

2

No you can't, the browsers need to see the code to execute it.

Dev'Hamz
  • 478
  • 4
  • 9
1

No. JavaScript files will always be accessible from client tools like IE dev tools or Chrome or just about any other browser's dev tools. You can take steps to make the js harder to read, but it will still be accissible

TGH
  • 38,769
  • 12
  • 102
  • 135
0

Yes, but the way is to stop people from accessing your site, which is probably worse. The way JavaScript works on most sites ( other than ones built on Node ) is that it is run in the browser and to do that it must be sent to the browser.

The reason it doesn't matter is that nobody wants to steal your code.

You need to remember that nothing you want to be kept secret should be in that JavaScript- run that on the server and pass the results out to front end - and for production you should probably be minimising your code anyway which provides a lot of obfuscation, but in general it is not worth worrying about.

glenatron
  • 11,018
  • 13
  • 64
  • 112
0

You cant. But you can minify them using for example Google's closure compiler or Microsoft Ajax Minifier. Minifying not only makes your javascript less in size, but also gives an obfuscation to your code, so it is much more harder to understand

Didar_Uranov
  • 1,230
  • 11
  • 26