In JavaScript, printing debug messages to Visual Studio debugger with IE

M

mikeorb

I'm debugging some JavaScript.

In Firefox I can use dump(msg) to print a message on their JS console
(see http://kb.mozillazine.org/Viewing_dump()_output). Likewise, Opera
has the opera.postError(msg) method.

Is there an equivalent in Internet Explorer that will work with Visual
Studio 2003 when using the JS debugger? I know how to set breakpoints,
display variables, etc.

Thanks!
-Mike
 
S

Stefan

JavaScript=clientside=Browser
VS2003=serverside=ASP.Net application

The only way to do this is to write a javascript function yourself
which uses AJAX/xmlhttprequest to post the debug message
from client to server.


If you don't wanna get into the intrinsics of xmlhttprequest,
there is an excellent ajax implementation for asp.net out there
(Ajax.net) which should make this very easy

http://www.developerfusion.co.uk/show/4704/
http://weblogs.asp.net/mschwarz/
 
M

mmuegel

Thanks Stefan. Of course I know JS is client side. I found found it
inconceivable that MS does not have a client side JS log facility and
figured ASP.NET people would know if this is truely the case. VS.2003
came up because of it's ability to debug client JS code, and I would
think MS would provide the equivalent of "Console.Write*" for the
client. Call me nuts.

-Mike
 
B

Bruce Barker

IE does not provide this feature. probably because IE had a javascript
debugger from the start, while the netscape line only had the console
display, and added the debugger later.

you can create a local var with a watch in the debugrer, and write to it
with the trace code. you can also write a quick trace lib, that writes to a
popup window


-- air code

var traceWin;
var doTrace = true; // could default to false and turn on in debugger
function trace (s) {
if (doTrace) {
if (traceWin == null) traceWin = window.open('about:blank','debug');
traceWin.document.body.InnerHTML += s + '<br>';
}
}


-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top