-2

I want to hide xhttp requests from the browser's console So.
What i have here is a ajax request repeating in certain intervals of time

setInterval(function(){
$.ajax({
type:'post'..
url:...
});
},20);

And when the code above executes, I have this in the browser's console

XHR finished loading: POST "https://fibble.tk/chats.php".
XHR finished loading: POST "https://fibble.tk/chats.php".
XHR finished loading: POST "https://fibble.tk/chats.php".
XHR finished loading: POST "https://fibble.tk/chats.php".

I tried to hide the following from the console by using the code below:

setInterval(function(){
console.clear();
},1);

For protection I want to hide these from the consoles and I don't think that i'm doing it the right way as when the script above is running , the console flashes again and again.

I'm looking for a better method for this
Any help is appreciated
EDIT
To see it just copy the above code and open the console and do paste the code

  • Check: https://stackoverflow.com/questions/12840024/xhr-finished-loading-log-message – Alexey Chuhrov Feb 19 '18 at 14:46
  • Is this a solution? https://stackoverflow.com/questions/12840024/xhr-finished-loading-log-message – Thijs Feb 19 '18 at 14:46
  • checked, that is to hide the request for a user, anyone can uncheck the option and view them again. I want to remove the logs for everyone –  Feb 19 '18 at 14:48
  • What kind of script needs an interval of 20ms???? And 1ms? Really? – brombeer Feb 19 '18 at 14:54
  • Possible duplicate of [XHR finished loading \[...\] log message](https://stackoverflow.com/questions/12840024/xhr-finished-loading-log-message) – Hyyan Abo Fakher Feb 19 '18 at 14:54
  • @HyyanAboFakher that is to hide the request for a user, anyone can uncheck the option and view them again. I want to remove the logs for everyone –  Feb 19 '18 at 14:55
  • Javascript is easily modified from the client. Someone can easily remove the call to clear the console. [Security through obscurity is a terrible idea](https://stackoverflow.com/questions/533965/why-is-security-through-obscurity-a-bad-idea), just some food for thought.. – IsThisJavascript Feb 19 '18 at 14:56
  • @kerbholz thought it will make the procedure smooth –  Feb 19 '18 at 14:57

1 Answers1

3

You cannot prevent the debug tools in the browser belonging to the user from telling the user what their browser is doing.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • Okay but those requests are exposed to the user, relating with the server. Will it ever cause any response to leak? [Here see this](https://blog.versionone.com/spy-on-browser-http-requests/) –  Feb 19 '18 at 15:05
  • That article is based on a false premise — that the browser is something that does not belong the user. The user can't "spy" on their browser any more than a carpenter can spy on their saw. The browser is an extension of the user. The user is asking your website for stuff. The website is giving the user that stuff. The browser is just the tool the user uses. Nothing you tell the browser can be a secret from the user. – Quentin Feb 19 '18 at 15:10
  • I didn't know it was based on a false premise. Okay I now know. –  Feb 19 '18 at 15:13