Here is my code which is displaying in console. What should I do to hide this code?
i don't know what and where i should use code to hide all this script. Please help me out.
-
2You cannot hide the javascript. It is rendered by the browser on the client - side.Shankar Narayana Damodaran– Shankar Narayana Damodaran2014-04-09 10:55:55 +00:00Commented Apr 9, 2014 at 10:55
-
1Why the heck is it being displayed on your console? It's only supposed to be there in the page source.AyB– AyB2014-04-09 10:59:24 +00:00Commented Apr 9, 2014 at 10:59
-
Everything you see in your browser, weather a picture or a video and so on, can be copied/grabbed/duplicate one way or another. I see you're using ajax so maybe you could move some of your code to run on the server. Other than that you don't have much more options.Gil– Gil2014-04-09 11:04:20 +00:00Commented Apr 9, 2014 at 11:04
Add a comment
|
1 Answer
JavaScript is always viewable by the end user, because it has to be interpreted by the browser. However, you can encode your JavaScript to use non human-readable symbols. Also, you can minify or compress your code here so that it all appears on one line, hence hardly readable by the user. In addition, look into base62 encoding of your code.
This is why it is not recommended to do anything security related on the client, because hackers can alter the code. Send the raw data to the server and then sanitize it!