There are much, much better ways of attaching a proper debugger to a web page these days. If you're reading this then you should probably consider a different approach.
A small drop in JS file that emulates the console on devices that are a pain to debug (iPad on a PC for example).
Usage:
Save console.js to your project and hook it in to the page using <script src="console.js"></script> ... and you're done.