Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@matheusmurta
Created October 7, 2019 19:39
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 matheusmurta/701ec92ade83403ee5d509d5c51dcf43 to your computer and use it in GitHub Desktop.
Save matheusmurta/701ec92ade83403ee5d509d5c51dcf43 to your computer and use it in GitHub Desktop.
Remove Alert in console
addJS_Node (null, null, overrideSelectNativeJS_Functions);
function overrideSelectNativeJS_Functions () {
window.alert = function alert (message) {
console.log (message);
}
}
function addJS_Node (text, s_URL, funcToRun) {
var D = document;
var scriptNode = D.createElement ('script');
scriptNode.type = "text/javascript";
if (text) scriptNode.textContent = text;
if (s_URL) scriptNode.src = s_URL;
if (funcToRun) scriptNode.textContent = '(' + funcToRun.toString() + ')()';
var targ = D.getElementsByTagName ('head')[0] || D.body || D.documentElement;
targ.appendChild (scriptNode);
}
alert = function() {};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment