chrome block javascript alert

Solutions on MaxInterview for chrome block javascript alert by the best coders in the world

showing results for - "chrome block javascript alert"
Ana
09 Nov 2019
1// ==UserScript==
2// @name        Wordswithfriends, Block javascript alerts
3// @match       http://wordswithfriends.net/*
4// @run-at      document-start
5// ==/UserScript==
6
7addJS_Node (null, null, overrideSelectNativeJS_Functions);
8
9function overrideSelectNativeJS_Functions () {
10    window.alert = function alert (message) {
11        console.log (message);
12    }
13}
14
15function addJS_Node (text, s_URL, funcToRun) {
16    var D                                   = document;
17    var scriptNode                          = D.createElement ('script');
18    scriptNode.type                         = "text/javascript";
19    if (text)       scriptNode.textContent  = text;
20    if (s_URL)      scriptNode.src          = s_URL;
21    if (funcToRun)  scriptNode.textContent  = '(' + funcToRun.toString() + ')()';
22
23    var targ = D.getElementsByTagName ('head')[0] || D.body || D.documentElement;
24    targ.appendChild (scriptNode);
25}
26