Content-Security-Policy error in google chrome extension making

前端 未结 1 653
轻奢々
轻奢々 2020-11-27 22:14

I am making a chrome extension that will open all links on a page in new tabs.

Here are my code files:

manifest.json

{
  \"name\": \"A browse         


        
1条回答
  •  我在风中等你
    2020-11-27 23:09

    One of the consequences of "manifest_version": 2 is that Content Security Policy is enabled by default. And Chrome developers chose to be strict about it and always disallow inline JavaScript code - only code placed in an external JavaScript file is allowed to execute (to prevent Cross-Site Scripting vulnerabilities in extensions). So instead of defining getPageandSelectedTextIndex() function in popup.html you should put it into a popup.js file and include it in popup.html:

    
    

    And

    0 讨论(0)
提交回复
热议问题