Date: 2011may26
Platform: web
Q. How can I log in a way that works for all browsers?
A. Firefox has dump() and IE has console.log() so make do this:
function debug(a) {
if (a == null) return;
if (a.indexOf('\n') < 0) a += '\n';
if (window.dump) {
dump(a); // Firefox
}
else if (window.console && window.console.log) {
window.console.log(a); // IE
}
}
function exampleUse() {
debug('testing');
}
More info
http://www.davekb.com/search.php?target=Firefox+dump
| What this info useful to you? You can donate to say thanks |
Add a comment
Sign in to add a comment