Файл end.js оставил без изменений.
background.js: chrome.tabs.executeScript({file: "/content_scripts/end.js"}); const getMessage = (message) => { transferCoordinate(message); } chrome.runtime.onMessage.addListener(getMessage); const transferCoordinate = (message) => { chrome.runtime.onMessage.removeListener(getMessage); if (message.command === "blablabla") { chrome.tabs.query({active: true, currentWindow: true}, (tabs) => { chrome.tabs.sendMessage(tabs[0].id, { command: "start-vkladka" }); }); } }
Как же исправить ошибку: "Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' blob: filesystem:". Either the 'unsafe-inline' keyword, a hash ('sha256-vaFEIKla3D+VhakLoTx5IxEMd+0pcos8lnGPeynEyBs='), or a nonce ('nonce-...') is required to enable inline execution." ?
Обсуждают сегодня