L
L
lowsentmy2020-05-20 10:22:13
JavaScript
lowsentmy, 2020-05-20 10:22:13

How to protect JS code?

I have JavaScript code. It can be viewed by viewing the element's code. But I want to hide it so that it can't be done. Or that when you open it there was just a set of characters that is not clear to a person.
How to implement it?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
A
Alexey Yarkov, 2020-05-20
@lowsentmy

It won’t work to hide, but it’s quite difficult to read a little. For example, using obfuscation . But be prepared to increase the amount of code.
For example console.log('Лол, кек, чебурек');, turn into

var _0xac52=["\u041B\u043E\u043B\x2C\x20\u043A\u0435\u043A\x2C\x20\u0447\u0435\u0431\u0443\u0440\u0435\u043A","\x6C\x6F\x67"];console[_0xac52[1]](_0xac52[0])
. Do you need it? IMHO all this is kindergarten.

F
Froggyweb, 2020-05-20
@Froggyweb

save to file
shame.js

S
Saboteur, 2020-05-20
@saboteur_kiev

switch to nodejs

F
freeExec, 2020-05-20
@freeExec

Don't sweat it, I think. Judging by the toaster, there are a lot of questions like how to do it the same way as here on the site. Those. rather than open the code and see go compose questions. Not to mention reading the API documentation.

X
xmoonlight, 2020-05-20
@xmoonlight

Through webasm, you can package the code.

K
kocherman, 2020-05-20
@kocherman

https://emscripten.org/
Compile code to your health!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question