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

74
Views
grab console output to dom with javascript

this is my html file

<script>

var output = console.dir(location);
document.write(output);

</script>

and iam trying to assign console output to a variable "output"
but its output is just

undefined

what i need is somewhat like,

{
  "ancestorOrigins": {
    "0": "https://www.google.com"
  },
  "href": "about:blank",
  "origin": "null",
  "protocol": "about:",
  "host": "",
  "hostname": "",
  "port": "",
  "pathname": "blank",
  "search": "",
  "hash": ""
}

output would be a json or array but it wouldn't be undefined
or do i have to use try & catch or something like that to get its output

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!