It seems that for some question pages, I receive the error TypeError: i is not a function
in the console.
For example for the question what can you do when window.location.href returns null, the error is pointing to line 1398, column 463 of the page. That line is a <script>
block that contains this minified code, that I beautified here:
window.clc_request = 'AoZ7GBgpv9QIUv1ZAF02UwICAAAAAgAAAANAAAAAfGphdmFzY3JpcHR8eC11c2VyLXJlZ2lzdGVyZWR8eC01MDAwcGx1cy1yZXB8eC1wZXJzb25hLWZyb250ZW5kfACRZGCvJBE00Zr8';;
! function i(n) {
var u, r;
try {
if ("function" != typeof [].indexOf) return;
if (!window.addEventListener) return;
if (!n.allowed) return;
if (!RegExp(n.allowed).test(location.hostname)) return;
var t = window,
i = t.document,
f = n.wv;
if (i.hidden && f) return void i.addEventListener("visibilitychange", function t() {
i.hidden || (i(n), i.removeEventListener("visibilitychange", t))
});
if (t.clc = t.clc || {}, t.clc.init = t.clc.init || [], n.autoload && t.clc.init.push(function(n) {
return n.load()
}), t.clc.options) {
for (u in t.clc.options) n[u] = t.clc.options[u];
t.clc.options = n
} else t.clc.options = n;
r = i.createElement("script");
r.async = !0;
r.src = n.lib;
i.body.appendChild(r)
} catch (i) {}
}.call(null, {
"lib": "https://cdn.sstatic.net/clc/clc.min.js?v=d80e98d967bf",
"u": "https://clc.stackoverflow.com/markup.js",
"azw": true,
"kt": 2000,
"tto": true,
"d": {
"sb": ["hireme", "clc-sb"],
"tlb": ["careers1", "clc-tlb"],
"mlb": ["careers3", "clc-mlb"]
},
"h": "clc.stackoverflow.com",
"autoload": true,
"allowed": "^(((talent\\.)?stackoverflow)|(blog\\.codinghorror)|(serverfault|askubuntu)|([^\\.]+\\.stackexchange))\\.com$",
"wv": true
});
The stack trace includes the function t
, which is the visibilitychange
event listener. Indeed, whenever I switch to a different tab, then switch back, the error counter increases by one.
The outer function is already called i
, but i
is also used as a local variable inside it that window.document
is assigned to (worryingly, t
is also used as both window
and a function). The event listener tries to use i
as both, by checking its hidden
property, but also calling it as a function; but it’s not a function.
This script block appears after some ad-related markup, so I assume, this is another ad-related script.