0

I have a chrome extension made in Javascript. The code works fine up until the code below, where I programatically open a new tab and try to interact with the new page, it gives the error:

Cannot set property 'innerHTML' of null

I tried it manually in the the browser console and it works.

content.js:

var win = window.open(url, '_blank');
win.focus;
document.getElementById('single_custom_css').innerHTML="123";

Manifest.json:

{
    "name":"Automate",
    "version":"1.0",
    "manifest_version":2,
    "content_scripts": [
        {
            "matches":["thesite.com"],
            "js":["content.js"]
        }
    ]
}

Thanks

doublesharp
  • 26,888
  • 6
  • 52
  • 73

0 Answers0