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

119
Views
Content Script runs before DOM is loaded in Instagram

I am making a chrome extension using content script, where it runs every time a url is changed and it runs fine in most sites, but in instagram the Array.from() comes as empty even though the html collection shows a tag is present. However this array returns a form when the page is refreshed

My Code in background.js

const init = () => {
  const forms = document.getElementsByTagName("form");
  const inputs = document.getElementsByTagName("input");
  console.log(Array.from(forms))
}
window.onload = init()

My manifest.json

{
  "name": "privacy",
  "description": "privacy kk",
  "manifest_version": 3,
  "version": "0.1",
  "background": {
    "service_worker": "scripts/background/background.js"
  },
  "action": {
    "default_popup": "popup.html"
  },
  "content_scripts": [
    {
      "matches": ["<all_urls>"],
      "js": ["scripts/content/content.js"],
      "css": ["styles/content.css"],
      "run_at": "document_idle"
    }
  ],
  "permissions": ["scripting", "tabs", "activeTab"],
  "host_permissions": ["<all_urls>"]
}

Kindly suggest me a fix

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!