How to find out what is calling a Javascript function

Scenario: What is calling a Javascript function.

You may have a situation where a function in your code (or anyone else's  for that matter) that is loaded into a web page is being called many times, and although in the Firebug profiler you may see the function being called 1000 times, you want to know who is responsible for calling it.

The problem: You may use the console.log in Firebug to do this, or even break in the function and step out of it to see who is calling it, but this may be difficult especially if it is being called many times by different callers/functions.

The solution: The Firebug "console.trace()" function provides this support perfectly.

Firebug is a free Firefox extension. Ready to install?

Print | posted @ Wednesday, July 8, 2009 9:18 AM

Comments on this entry:

Gravatar # re: How to find out what is calling a Javascript function
by Subham@java interview questions at 11/25/2017 8:55 PM

Thanks for the great post on How to find out what is calling a javascript function.You can find the java interview questions here on http://javahungry.blogspot.com/2013/06/top-25-most-frequently-asked-core-java.html
Post A Comment
Title:
Name:
Email:
Comment:
Verification: