Skip to main content
Question Protected by Trenton McKinney
Removed ? because the title is not a question; it's missing an auxiliary verb (e.g. How do I ...?) and removed redundant terms
Link
Trenton McKinney
  • 63.2k
  • 41
  • 169
  • 212

How to get JavaScript caller function line number? How to get JavaScript and caller source URL?

edited tags
Link
Kara
  • 6.2k
  • 16
  • 54
  • 58
Minor edit: grammar/spelling/case/punctuation/etc. Removed cruft - see http://meta.stackoverflow.com/questions/30142/how-to-correct-trivial-mistakes-in-answers/30146#30146
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

How to get javascriptJavaScript caller function line number? howHow to get javascriptJavaScript caller source url URL?

I am using the following for getting javascriptthe JavaScript caller function name:

var callerFunc = arguments.callee.caller.toString();
callerFuncName = (callerFunc.substring(callerFunc.indexOf("function") + 8, callerFunc.indexOf("(")) || "anoynmous")

Is there a way to discover the line number from which the method was called?

Also, is there a way to get the name of the jsJavaScript file the method was called from? orOr the source urlURL?

Thanks, Tal.

How to get javascript caller function line number? how to get javascript caller source url ?

I am using the following for getting javascript caller function name:

var callerFunc = arguments.callee.caller.toString();
callerFuncName = (callerFunc.substring(callerFunc.indexOf("function") + 8, callerFunc.indexOf("(")) || "anoynmous")

Is there a way to discover the line number from which the method was called?

Also, is there a way to get the name of the js file method was called from? or the source url?

Thanks, Tal.

How to get JavaScript caller function line number? How to get JavaScript caller source URL?

I am using the following for getting the JavaScript caller function name:

var callerFunc = arguments.callee.caller.toString();
callerFuncName = (callerFunc.substring(callerFunc.indexOf("function") + 8, callerFunc.indexOf("(")) || "anoynmous")

Is there a way to discover the line number from which the method was called?

Also, is there a way to get the name of the JavaScript file the method was called from? Or the source URL?

added tags
Link
Tal
  • 1.8k
  • 4
  • 18
  • 20
Loading
added 10 characters in body
Source Link
rahul
  • 187.5k
  • 50
  • 239
  • 266
Loading
Source Link
Tal
  • 1.8k
  • 4
  • 18
  • 20
Loading