title: Chrome Extension: Cannot access contents of URL starting with "chrome-extension://"
body: <p>In my extension, I am creating a tab and opening a html file named <code>results.html</code> in it from my background script named <code>background.js</code> . After creating a tab I am injecting a javascript file named <code>results.js</code> to that newly created tab.</p>
  
  <p>But it throws the following error in my <code>background.js</code> console:</p>
  
  <pre><code>Unchecked runtime.lastError: Cannot access contents of url "chrome-extension://hcffonddipongohnggcbmlmfkeaepfcm/results.html". 
  Extension manifest must request permission to access this host.
  </code></pre>
  
  <p>Going through the solutions on other stackoverflow questions I have tried adding following permissions in <code>manifest.json</code>:</p>
  
  <ol>
  <li><code>&lt;all_urls&gt;</code></li>
  <li><code>chrome-extension://*</code> Error thrown: Permission 'chrome-extension://*' is unknown or URL pattern is malformed.</li>
  </ol>
  
  <p>But none of above worked.</p>
  
  <p>Also the <code>results.js</code> after injected is supposed to send message to <code>background.js</code> to get in response some data to feed in <code>results.html</code> .</p>
  
  <p>My Code:</p>
  
  <p>manifest.json</p>
  
  <pre><code>{
    "manifest_version":2,
    "name":"Extension Name",
    "description":"This is description of extension.",
    "version":"1.0.0",
    "icons":{"128":"icon_128.png"},
    "browser_action":{
        "default_icon":"icon.png",
        "default_popup":"popup.html"
    },
    "permissions":["activeTab", "background", "tabs", "http://*/*", "https://*/*","&lt;all_urls&gt;"],
    "background": {
        "scripts": ["background.js"],
        "persistent": false
    },
    "web_accessible_resources": ["addAlias.js","results.html","results.js"]
  }
  </code></pre>
  
  <p>background.js</p>
  
  <pre><code>/*Some code*/
  function loadResult()
  {
    chrome.tabs.query({active:true},function(tabs){
      //creating tab and loading results.html in it
      chrome.tabs.create({url : 'results.html'}, function(tab){
        //injecting results.js file in the tab
        chrome.tabs.executeScript(tab.id, {file: 'results.js'});  
      });
    });
  }
  /*somecode*/
  if(/*some condtion*/)
  {
      loadResult(); //calling function 
  }
  
  
  chrome.runtime.onMessage.addListener(function(request,sender,sendResponse)
  {
    //Listening for results.js request for data
    if( request.greeting === "sendResults")
      {
        console.log(" Results request received .");
        //sending data back to results.js
        sendResponse({failed:failedToAdd,succeed:succeedToAdd});
  
      }
  }
  </code></pre>
  
  <p>results.js</p>
  
  <pre><code>/*Some code*/
  console.log("I got loaded");
  console.log("Now requesting for sendResults");
  
  //Below sending request for data
  chrome.runtime.sendMessage({greeting: "sendResults"},
        function (response) {
          console.log('Got data from Background.js');
          /*Some Code*/
        }
    );
  </code></pre>