-
-
Save jbinkleyj/db3681596875d0ad99f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.write = (function(write){ | |
var override = function() { | |
if(document.readyState !== "loading") { // document has finished loading - we want to intercept this call to document.write | |
if (window.ueLogError) { | |
try { | |
throw new Error("`document.write` called after page load on the gateway."); | |
} | |
catch(e) { | |
ueLogError(e, { logLevel : 'ERROR', attribution: 'gw-third-party-js' }); | |
} | |
} | |
} | |
else if(write.apply) { // modern browsers | |
write.apply(document, Array.prototype.slice.call(arguments, 0)); | |
} | |
else { // old versions of IE | |
document.write = write; | |
var args = ""; | |
for(var a=0; a<arguments.length; a++) { | |
args += (args?",":"")+"arguments["+a+"]"; | |
} | |
eval("document.write("+args+");"); | |
document.write = override; | |
} | |
}; | |
return override; | |
}(document.write)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment