Skip to content

Instantly share code, notes, and snippets.

@bonza-labs
Created August 30, 2011 19:48
Show Gist options
  • Save bonza-labs/1181835 to your computer and use it in GitHub Desktop.
Save bonza-labs/1181835 to your computer and use it in GitHub Desktop.
Stub the widow.console object when not available
if (typeof window.console === "undefined") {
var noOpFunc = function() { };
window.console = {
assert: noOpFunc,
log: noOpFunc,
warn: noOpFunc,
debug: noOpFunc,
info: noOpFunc,
time: noOpFunc,
timeEnd: noOpFunc,
profile: noOpFunc,
profileEnd: noOpFunc,
dir: noOpFunc,
dirXml: noOpFunc,
group: noOpFunc,
groupEnd: noOpFunc,
markTimeline: noOpFunc,
trace: noOpFunc
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment