Created
August 11, 2012 21:26
-
-
Save rocktronica/3327415 to your computer and use it in GitHub Desktop.
Fake console for iPads, etc
This file contains hidden or 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
(function(){ | |
document.body.innerHTML += '<pre id="preConsole" style="position: absolute; left: 10px; top:10px; height: 200px; width: 400px; background-color: rgba(0,0,0,.9); *background: #000; color: #fff; z-index: 1000; padding: 10px; overflow: auto; font: 12px/15px Monospace; margin: 0;"></pre>'; | |
var pre = document.getElementById("preConsole"); | |
window.console = { | |
log: function() { | |
var a=[], iCount=arguments.length; | |
for (var i=0; i<iCount; i++) { a.push(typeof arguments[i] === "object" ? JSON.stringify(arguments[i]) : arguments[i].toString()); } | |
pre.innerHTML += a.join(', ') + '\n'; | |
} | |
}; | |
window.onerror = function() { window.console.log("ERROR:", arguments); }; | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
took out the condition checks, since you shouldn't be putting this live anywhere. background hack for ie6/7.