Estoy tratando de hacer una extensión de Chrome simple que reemplace todas las imágenes con otra ( img.jpg ).
Carpeta principal
window.html :
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>ClrImgs</title> <script type="text/javascript" src="clrimgs.js"></script> </head> <body> <button onclick="clrimgs()"></button> </body> </html> clrimgs.js :
function clrimgs(){ images = document.getElementsByTagName("img") for(image in images){ image.src = "img.jpg"; } } manifest.json :
{ "manifest_version": 3, "name": "Name", "description": "Description", "version": "1.0", "minimum_chrome_version": "46", "content_security_policy": { "extension_pages": "script-src 'self' 'unsafe-eval'; object-src 'self'", "sandbox": "..." }, "action": { "default_icon": "img.jpg", "default_popup": "window.html" } }Cuando intento recargar la extensión, aparece este error:
'content_security_policy.extension_pages': valor de CSP no seguro "'unsafe-eval'" en la directiva 'script-src'. No se pudo cargar el manifiesto.
¿Hay alguna forma de usar MV3 y seguir usando dicho código? Si es así, ¿qué estoy haciendo mal? He intentado hacer muchas cosas, pero sigo recibiendo un error u otro.