0

I am making an extension which downloads files from specified websites by the user. What I am doing now is making the list of websites and a button next to each website to download the files from that website. I guess the problem is I don't understand the inline policy for extensions by chrome, but everytime i hit click i get the:

Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src 'self' chrome-extension-resource:".

I have looked around this mistake and tried different solutions but non worked. Any help? thank you!

This is the code:

    //printURLs receives an array of TrackedWebsites and print the urls on the main popup
    //It prints also the button to download the files from that website

function printURLs(websites){
  var i;
  var elem = document.getElementById("websitesList");
  console.log(websites);
  for (i = 0; i<websites.length; i++){          
        var node = document.createElement("li");
        var url = document.createTextNode(websites[i].get_URL);
        var downloadButton = document.createElement('input');
        downloadButton.setAttribute('type','button');
        downloadButton.setAttribute('name','down'+i);
        downloadButton.setAttribute('value','DL');                               
        downloadButton.setAttribute("onclick","clickDownloadFiles(websites[i])");
        console.log(websites[i].get_URL);               
        node.appendChild(url);
        node.appendChild(downloadButton);
        elem.appendChild(node);
   }
 }



 function clickDownloadFiles(website){

        var filesURLs = retrieveFilesURLs(website);
        downloadFiles(filesURLs);
    }
4

1 回答 1

1
于 2013-07-30T21:44:41.483 回答