Javascript Chrome扩展内容安全策略

Javascript Chrome扩展内容安全策略,javascript,google-chrome,google-chrome-extension,Javascript,Google Chrome,Google Chrome Extension,我正在为Google Chrome创建一个扩展,我遇到了一个小问题,实际上,该扩展可以工作,但我不喜欢检查它并看到以下错误: 拒绝执行内联脚本,因为它违反了以下内容安全策略指令:“script src'self'chrome extension resource:” 我不知道是什么原因导致了这个错误,这是我在manifest.json中看到的: { "manifest_version": 2, "name": "Pokémon Search", "short_name"

我正在为Google Chrome创建一个扩展,我遇到了一个小问题,实际上,该扩展可以工作,但我不喜欢检查它并看到以下错误:

拒绝执行内联脚本,因为它违反了以下内容安全策略指令:“script src'self'chrome extension resource:”

我不知道是什么原因导致了这个错误,这是我在manifest.json中看到的:

{
    "manifest_version": 2,

    "name": "Pokémon Search",
    "short_name": "PokéSearch",
    "description": "This extension searches for the desired Pokémon at Bulbapedia and Serebii.",
    "version": "1.1.0",

    "permissions": [ "tabs" ],
    "icons": {
    "16": "16.png",
    "48": "48.png",
    "128": "128.png"
    },
    "browser_action": {
        "default_icon": "icon.png",
        "default_popup": "popup.html"
    }
}
这是我在popup.html中的内容:

<!doctype html>
<html>
    <head>
        <script type='text/javascript' src='jquery.js'></script>
        <script type='text/javascript' src='listOfPokemon.js'></script> 
        <script type='text/javascript' src='listOfMove.js'></script> 
        <script type='text/javascript' src='listOfItem.js'></script> 
        <script type='text/javascript' src='mcs.js'></script>   
        <script type='text/javascript' src='popup.js'></script> 

        <link rel='stylesheet' type='text/css' href='popup.css' />
    </head>

    <body>
        <h5>Pok&eacutemon Search</h5>

        <form id='mainForm'>
            <div align='center'><h6>What do you want to search?</h6><br /></div>
            <input type='radio' name='searchType' id='searchPokemon' value = 'pokemon' checked='checked' /><h6>Pok&eacutemon</h6><br />
            <input type='radio' name='searchType' id='searchMove' value = 'move' /><h6>Move</h6><br />
            <input type='radio' name='searchType' id='searchItem' value = 'item' /><h6>Item</h6>
            <input type='text' id='pokemonName' />
            <input type='radio' name='destinyPage' id='radioBulbapedia' value='bulbapedia' checked='checked'/><h6>Search on Bulbapedia</h6>
            <input type='radio' name='destinyPage' id='radioSerebii' value='serebii'/><h6>Search on Serebii</h6><br /><br />
            <div align='center'><h6>Generation (Serebii only)</h6>
            <input type='number' name='generation' id='gen' value='6' max='6' min='1'/><br />
            <input type='button' id='submitButton' value='Search' /></div>
        </form>

    </body>
</html>

Pokémon搜索
您想搜索什么?
Pokémon
移动
项目 在Bulbapedia上搜索 搜索Serebii

发电(仅限Serebii)
popup.js:
这是唯一一个影响popup.html中任何元素的文件

可能您的一些脚本通过插入带有外部src的脚本节点来操作DOM。没有关于错误的更多详细信息吗?它只是说,并指向popup.html first line=/I将使用其他文件的链接更新问题要查找错误原因,请按相反顺序逐个删除所有
元素,直到CSP错误消失。别忘了仔细研究.Thx Rob W的文档,问题在于jquery.js,我必须修改代码中的一些内容,但至少不会再出现任何错误^^^^事实上,没有jquery.js D=我不知道为什么”document.getElementById(“submitButton”)。单击(搜索)不起作用,它给了我错误“UncaughtTypeError:无法调用null的'click'方法”