my first Edge Extension which I am coding for learning purposes does not work, as it generates the following errors: Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution. Note that hashes do not apply to event handlers, style attributes and javascript: navigations unless the 'unsafe-hashes' keyword is present.
the same with: ... "script-src 'self''wasm-unsafe-eval' 'inline-speculation-rules' http://localhost:* http://127.0.0.1:*" ...
The Extension is supposed to open a website which contains laws. The URL consists of some text, the legal code and the paragraph, which are input via text fields.
Although the input fields are displayed on click of the extension icon and I can input text and click the submit button, nothing happens.
The project consists of the following files:
manifest.json
{
"name": "JurSearch",
"version": "0.0.0.1",
"author": "FN",
"manifest_version": 3,
"description": "An extension to search the German laws.",
"icons": {
"16": "icons/fernglas.png"
},
"action": {
"default_popup": "popup/popup.html"
},
"permissions": [
"contextMenus",
"tabs",
"storage",
"activeTab"
],
"background": {
"service_worker": "js/background.js",
"type": "module"
}
}
popup.html
<html lang="de">
<head>
<meta charset="UTF-8" />
<title>Search</title>
</head>
<body>
<div>
<form id="form" onsubmit="return false;">
<label for="Gesetz">Legal Code:</label>
<input type="text" id="Gesetz" name="Gesetz"/><br><br>
<label for="Norm">§/Art.:</label>
<input type="text" id="Norm" name="Norm"><br><br>
<input type="submit" value="Submit" onclick="OpenSite();"/>
</form>
</div>
</body>
</html>
background.js
function OpenSite() {
let Gesetz = document.getElementById("Gesetz").value;
let Norm = document.getElementById("Norm").value;
let Web = "https://dejure.org/gesetze/";
let Site = Web.concat(Gesetz, "/", Norm, ".html");
window.open(Site, "_blank");
}
I do not know how to fix it and am new to coding so I would be very thankful for your help.
Thank you