I wanted to know if there is a way to make your JavaScript private from client side?

  • That's not duplicate I want to make it invisible not even encrypt it. – Faiz Ahmed May 4 '14 at 5:24
  • 3
    @FaizAhmed in some sense it is, since (as you see from the only answer) obfuscating is the only option here (and not worth much). You must keep important stuff on the server and make sure that security doesn't depend on params sent from the browser. – thorsten müller May 4 '14 at 9:06

You cannot make client-side javascript private. You can obscure it by running a program that will shorten all the variable names into meaningless names, but by definition if it can be read and executed by a browser, so can it be read by a person.

  • So how does node.js works – Faiz Ahmed May 4 '14 at 5:30
  • node.js does not run in a browser. It runs on a server or desktop computer somewhere and usually loads scripts locally. Those scripts can be kept locally because they are never served to a browser. – jfriend00 May 4 '14 at 5:31
  • Do you have experience in this technology? – Faiz Ahmed May 4 '14 at 5:33
  • Can you ask a more specific question? I've written javascript for both browser and node.js. – jfriend00 May 4 '14 at 5:34
  • 2
    It sounds like you don't understand that node.js runs on the server and the browser javascript runs on the client. You can't mix the two. You can use any server-side language you want (Python, C++, Java, javascript, PHP, etc...). Only javascript runs in the browser. You can make ajax calls from browser to server if you want. – jfriend00 May 4 '14 at 5:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.