Click here to Skip to main content
15,884,537 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Good afternoon, and thank you for looking at this...

I have some jQuery code.
It runs perfect when using Firefox's debugger mode and using breaks since the page loads.

But if I'm not using the debugger mode, it simply doesn't work.

Any recommendations? Ever been into something like that?
Posted

1 solution

Most likely, the solution is simple: your code doesn't work under the debugger as well, but you fail to notice that, because the debuggers gives you some information on what's going, on, but "normal" operation of the JavaScript in browser simply "swallows" the exceptions and seize the operation.

One apparent approach to development is: handle the exceptions. Basically, it would be enough to handle all exceptions on top stack frame of your code of the <body> element, if any, plus on top stack frame of the code of each event handler. Then you need to present the exception information the way it does not throw exceptions itself.

This might be not enough. Some problems of your code can be lexical. They won't be caught as exceptions in a usual way. But I have one secret weapon: eval. The technique is described in detail in my article, the section "5 Handling Lexical Errors": JavaScript Calculator[^].

In the same article, you can find more detailed advice and code for exception handling.

—SA
 
Share this answer
 
Comments
Homero Rivera 1-Jun-15 0:31am    
Sorry it took so long to check the answer... Lots of work :(
Sergey Alexandrovich Kryukov 1-Jun-15 11:16am    
There is no need to be sorry or apologize, this is not a problem at all. I'm glad it helped you.
Good luck, call again.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900