Getting below error when trying to use checkbox, or switch buttons. My application is ASP.NET Core 7.
Refused to load the image 'data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23ffffff'/%3e%3c/svg%3e' because it violates the following Content Security Policy directive: "default-src 'self'". Note that 'img-src' was not explicitly set, so 'default-src' is used as a fallback.
(anonymous) @ plugins.bundle.js:57470
(anonymous) @ plugins.bundle.js:57334
(anonymous) @ plugins.bundle.js:57335
This issue is resolved by adding the following lines of code:
var csp = "default-src 'self'; img-src data: https:; object-src 'none'; frame-ancestors 'none'; sandbox allow-forms allow-same-origin allow-scripts; connect-src https: wss:; base-uri 'self'; script-src 'self'; style-src 'self'; upgrade-insecure-requests;";
if (!context.HttpContext.Response.Headers.ContainsKey("Content-Security-Policy"))
{
context.HttpContext.Response.Headers.Add("Content-Security-Policy", csp);
}
Hi Vish Paibir,
Sorry for the late reply.
Glad to hear that you have already resolved this problem.
Please don't hesitate to reach out if you need anything more from us.
Regards,
Lauris Stepanovs,
Keenthemes Support Team