views:

227

answers:

6

I have some error in my JavaScript which should open a dialog with an image in it (works) and then call the JQZoom plugin on that image (doesn't work). I think Firebug outputs some error into the console. My code is supposed to intercept the click of a hypertext link and then return false to prevent the browser from moving to another page. However, since something fails with the JQZoom call, it never reaches return false, causing a page switch and then I can't see what error there was.

So is there any way to make Firebug output errors somewhere persistent? Or can I find the latest errors somewhere?

A: 

I dont know any way to do what you ask but You can try debuggin your javascript code with FireBug. Just put some breakpoints before executing the code, then step through them

Nuno Furtado
I'd like to avoid that actually, since this is JQuery and JQuery has a *lot* of overhead.
Deniz Dogan
If you use step over as opposed to step in, you'll see the debugger go in terms of your code, not the jQuery internals.
Tony k
A: 

I managed to "solve" this by using setTimeout to call JQZoom on the image. This way the browser manages to get to return false before failing. Firebug says that there is an error but I can't find anything in the console...

Deniz Dogan
There is a menu to filter which kind of errors Firebug displays in the console :/
Aaron Digulla
A: 

You can log to the Firefox/Firebug console from your code.

[EDIT] The idea here is that you dump information about the object state to the console and/or put a try/catch block around the suspected code and log the exception to the console.

Aaron Digulla
I'm well aware of this, but there is really nothing to log to it, because I know exactly what piece of code that fails.
Deniz Dogan
A: 

In a pinch you could use privilege escalation:

netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");

and file I/O:

Justin Love
A: 

I am having the same issue trying to zoom in on an image inside a dialog. Did you figure out a solution?

A: 

If there is a page load between when the error occurs, you can -- theoretically -- find the error in the Firefox error console (Tools | Error Console). I say theoretically because lately I have seen instances that do not report there but I have not narrowed down what instances those are.

From there, I usually set breakpoints to help debug the script.

Rob