Are there ways to hide the JavaScript code on the WEB-pages?

  • 2
    just don't add the code. And no one will see him. - KoVadim
  • Will not work. In my case, JS is needed - AseN

6 answers 6

Try some obfuscator JavaScript, I will not recommend a specific program, the Internet is full of information about this.

  • 2
    If the executed code really has such importance, then it is better to execute it on the server. The time spent on obfuscation may not justify itself. - Jakeroid 4:02 pm
  • And what kind of obfuscator? - AseN 4:04 pm
  • Well, for an example, see javascriptobfuscator.com/default.aspx - morin
  • CLASS! And where have you ever been with this obfuskator!? - AseN
  • And here, for example: github.com/mishoo/UglifyJS2 - eigenein

How exactly to hide, I will not tell you, but maybe you need to separate the necessary part of the code and transfer it to the server, and leave the lightweight script on the page and communicate with the server using AJAX?

  • Maybe even so ... - AseN
  • Simply, in my opinion, this is the most humane way. - Jakeroid

JavaScript should execute a browser - so, in principle, you cannot hide it. It can be minimized - this will reduce the clarity of the code, but it will still be open.

For good, what users do not need to see is to be performed on the server.

In any case, the browser must execute unencrypted code, so an attacker (competent) will be able to see 100% of it if he wants.

  • Well, Js is not particularly dangerous when changing. The worst thing you can do basic JS - steal cookies =) - AseN

JS is performed by the browser - therefore there are no adequate ways to hide it (except for some encoding - but this is already at the level of insanity, IMHO).

  • Thank you, I will consider =) - AseN

You are looking for how to hide, I am looking for someone who needs it :)))))

In principle, of course, you cannot hide what is transferred to the browser, but it is practically possible.

Question:

Are there ways to hide the JavaScript code on the WEB-pages?

Answer:

There are ways to hide JavaScript-code on WEB-pages !!!

http://javascript.ru/forum/misc/50004-spor-o-skrytii-kontenta.html

  • And how to use it. It just says that it is possible ... that they would do what they say ... - AseN

To protect against simple copying of the source, it is best to use obfuscator (by the way, this is also a good service). And you can embed a location.href check into an encrypted script. And trying to protect the code from professionals is pointless ... Now (only for scientific interest =)) I looked at the service offered by Van ... I got the code for the registration page in about two minutes, which confirms once again that it is impossible to completely hide the code.

  • Well, yes =) Everything, everything has already become clear .... the question can be closed. - AseN