我正在为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émon 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émon</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>
popup.js:https://www.dropbox.com/s/tczqpaom0igy2bh/popup.js 这是唯一影响popup.html
中任何元素的文件