Set img src in content script

How to access image path from content script? I have added the image to “web_accessible_resources”. I have tried browser.extension.getUrl(imgName.jpg) , but I get an error that browser is not defined.

Thank you.

browser should be accessible from content scripts, so there must be something else going wrong.