I\'m dealing with a system where the following Javascript code (which is out of my control) is being executed early in the page
if (!(\"console\" in window)
Can't you put your own script directly in the head of the html right at the top?
... html ...