How we can hide javascript/jQuery cotents/code from others?
i want to hide javascript from user/anyone when someone want to viewsource of page.
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Manoj BhoirRank #599 · 4K reputationPosted Sep 23, 2015, 7:06 AM EDT
Short answer: You can't/don't.
Longer answer: You cannot hide it at all. It runs on the client and it cannot be compiled to machine code. However, you could minify it - that's basically obfuscating it by shortening variable names, removing whitespace, etc. While it's usually used to save bandwidth it also makes the code less readable. Note that all but the changed variable names and removed comments can be easily undone by something like jsbeautufier. but for a large application it's very hard to understand the code without any meaningful variable/function names or comments.
Ajeet MishraRank #2,007 · 723 reputationPosted Sep 23, 2015, 9:43 PM EDT