title: Chrome Extension | How to include library in content and background scripts from cdn
body: <p>my Chrome extension has two files: content and background scripts. I need to add jQuery to content script from cdn and lodash to background script from cdn too.</p>
  
  <p>In my manifest I tried to add lodash from cdn like this:</p>
  
  <pre><code>"background": {
        "scripts": ["background.js", "https://cdn.jsdelivr.net/lodash/4.13.1/lodash.min.js"]
    },
  
    "content_security_policy": "script-src 'self' https://cdn.jsdelivr.net;     object-src 'self'"
  </code></pre>
  
  <p>But that didn't help. </p>
  
  <p>My content file is injected to the page from the background file:</p>
  
  <pre><code>chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
      if (changeInfo.status == 'complete') {
          chrome.tabs.insertCSS(null, {file: "mainStyles.css"});
          chrome.tabs.executeScript(null, {
              code: 'var config = ' + JSON.stringify(config)
          }, function() {
              chrome.tabs.executeScript(null, { file: "https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js" }, function()     {
                  chrome.tabs.executeScript(null, { file: "content.js" })
              });
          });
      }
  });
  </code></pre>
  
  <p>And as you can see I tried to include jQuery from cdn but this way it's not included either.</p>
  
  <p>Maybe someone knows the way how to do this? 
  Many thanks in advance!</p>