Skip to content

Instantly share code, notes, and snippets.

@jsakhil
Created September 28, 2017 07:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsakhil/79b255a6731d45049624ba0241718bb4 to your computer and use it in GitHub Desktop.
Save jsakhil/79b255a6731d45049624ba0241718bb4 to your computer and use it in GitHub Desktop.
Trick to Hide Element in source code when debugger is opened
var currentInnerHtml;
var element = new Image();
var elementWithHiddenContent = document.querySelector("#elementtohide");
var innerHtml = elementWithHiddenContent.innerHTML;
element.__defineGetter__("id", function() {
currentInnerHtml = "";
});
setInterval(function() {
currentInnerHtml = innerHtml;
console.log(element);
console.clear();
elementWithHiddenContent.innerHTML = currentInnerHtml;
}, 1000);
//Created By Adhersh M Nair
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment