How to detect which page the function was called

hi people i have a funtion in my js file, and inside that function i need ditect from which page is calling…
any ideia???
Thanks…

Generating a stack-trace didn’t help?

What function in what file? How is it called. Give use more context