Re: How to get the Javascript file name from a function inside the file.
Ryan Hubbard said:
[color=blue]
>The point is if we call a function which resides in a javascript file.
>Can that function determine what file it came from.[/color]
You cannot call a function that resides in a javascript file.
That's not just a semantical quibble. It's central to your problem.
At the time the page was loading, the function source was loaded from a
particular javascript file, but at the time that the function executes, that
relationship no longer exists. It is simply one of many functions loaded in the
current page.
In some browsers you may be able to search the contents of scripts that were
loaded to find the source for a function of the same name, but that doesn't even
ensure that you've found the source for the function that's executing.
Ryan Hubbard said:
[color=blue]
>The point is if we call a function which resides in a javascript file.
>Can that function determine what file it came from.[/color]
You cannot call a function that resides in a javascript file.
That's not just a semantical quibble. It's central to your problem.
At the time the page was loading, the function source was loaded from a
particular javascript file, but at the time that the function executes, that
relationship no longer exists. It is simply one of many functions loaded in the
current page.
In some browsers you may be able to search the contents of scripts that were
loaded to find the source for a function of the same name, but that doesn't even
ensure that you've found the source for the function that's executing.
Comment