0

I want to use oninput in an input field within the default_popup of a chrome extension but I get the below CSP related errors.

Does Manifest v3 not support oninput? Do I need to put in some exception or forced to use a different approach?

Trying to implement this working jsfiddle https://jsfiddle.net/markusd1984/3o8bxc27/1/ .

 <input type="text" id="durationtimestamp" value="00:00" oninput="durationtimestamp(this.value)" required="required" style="width:35px;">

js

function durationtimestamp(value) {

Error:

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.

popup.html:67 Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src 'self' 'wasm-unsafe-eval'". 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.

Markus
  • 458
  • 4
  • 16
  • 1
    I don't know, but I'm curious why you're using an inline event handler, which is [not recommended](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#inline_event_handlers_%E2%80%94_dont_use_these). – Thomas Mueller Nov 11 '22 at 15:20
  • Thanks, I was using this from https://stackoverflow.com/a/10004863/8719001 as I need to keep a texts input in sync with a range slider. Might you have a better suggestion? Whether I can either allow for inline event handler to use current solution or change the input/function ? cheers – Markus Nov 11 '22 at 16:02
  • Found out to use addeEventListener instead, that was the missing information – Markus Nov 12 '22 at 11:40

0 Answers0