Currently working on a Chrome extension, I am attempting to insert a div with a background image into the DOM using a content script. The CSS is loading correctly, and upon inspecting the Developer Tools, the image URL appears to be correct.
$('.close-button').css('background', 'url('+chrome.extension.getURL('img/btn_close.png')+')');
When inspecting the URL in the console, it shows as
chrome-extension://fdghianmcdbcgihapgdbjkdoaaocmoco/img/btn_close.png
Despite this, the image fails to load as the background. Interestingly, if I use the same URL as the src attribute of an img tag, the image simply displays as broken in the browser.
However, when directly pasting the URL into the browser's address bar and loading it, the image appears perfectly fine. What might be causing the issue when trying to load it into the DOM?