netyro
netyro

Reputation: 38

How to find source for "Refused to execute inline event handler Because violates CSP blabla"

Keep getting this error and i know what it means, But can't find the source.

enter image description here

click the console source only leads me here.

enter image description here

Upvotes: 0

Views: 232

Answers (2)

root
root

Reputation: 6068

Add report-uri to your CSP header, then look at the generated report. It will tell you the source file and the line number.

The generated report will go to your URI, but it will also be visible in the network tab in the browser's dev tools.

Upvotes: 0

Chase
Chase

Reputation: 3116

Just search your source code (html) for any inline instances of on*="..." (e.g. onClick, onclick, onSubmit, etc..) since you seem to have inline event handlers.

Other event handler names can be found here and in the linked documentation: https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers

Upvotes: 0

Related Questions