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