Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

260
Views
Get the file name where a JavaScript Object has been defined using JS only (no dev tool)

Let's imagine we visit a random website where N javascript files are loaded:

- file1.js
- file2.js
- file3.js
...
- fileN.js

We have the following global variable of type Object window.myObject

The question is: is there a way to get the file name where window.myObject has been defined?

I know this can be done using the browser's dev tools, but I would like to have a function that does this for me.

Where I'm at: I feel like there might be a way to add a setter to window.myObject, to add a test property, and to console.trace() via the setter, but I'm not advanced enough to understand how exactly (and to even know if this is doable).

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!