L
L
LyoneNET2015-02-09 22:40:58
JavaScript
LyoneNET, 2015-02-09 22:40:58

How to disable access to js variables from console?

Hello.
Perhaps this is superfluous, but still.
How to disable the display of variable values ​​via console.log(%var%)?
My site consists entirely of json responses from the php server, and through the developer console you can see what is in the variables.
Is there any way to protect variables from being viewed through the console?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
DevMan, 2015-02-09
@LioneNET

Don't be fooled: the console isn't the only way to see your json.

A
Alexander Taratin, 2015-02-09
@Taraflex

(function(){
"use strict";

//приватная переменная
var a = 100500;

})()

I
IceJOKER, 2015-02-09
@IceJOKER

JS is client-side, if that tells you anything.
And about the question itself - a local variable should not be available through the console (correct if I'm wrong), only global variables

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question