I'm building a Chrome extension, and am trying to add a div with a background image to the DOM via a content script. The CSS loads in correctly, and the image URL seems to be correct looking at it via the Developer Tools inspector.
$('.close-button').css('background', 'url('+chrome.extension.getURL('img/btn_close.png')+')');
The URL shows up in the inspector as
chrome-extension://fdghianmcdbcgihapgdbjkdoaaocmoco/img/btn_close.png
But the image does not load in the background. If I do the same thing, but load the image as the src of an img tag, the image plainly shows as broken in the browser.
However, when I paste this URL into the browser URL bar and load it, it shows up fine. What's the problem loading it into the DOM?