close

[Solved] Content Security Policy: The page’s settings blocked the loading of a resource

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Content Security Policy: The page’s settings blocked the loading of a resource in javascript. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Content Security Policy: The page’s settings blocked the loading of a resource Error Occurs?

Today I get the following error Content Security Policy: The page’s settings blocked the loading of a resource in javascript.

How To Solve Content Security Policy: The page’s settings blocked the loading of a resource Error ?

  1. How To Solve Content Security Policy: The page's settings blocked the loading of a resource Error ?

    To Solve Content Security Policy: The page's settings blocked the loading of a resource Error I got around this by upgrading both the version of Angular that I was using (from v8 -> v9) and the version of TypeScript (from 3.5.3 -> latest).

  2. Content Security Policy: The page's settings blocked the loading of a resource

    To Solve Content Security Policy: The page's settings blocked the loading of a resource Error I got around this by upgrading both the version of Angular that I was using (from v8 -> v9) and the version of TypeScript (from 3.5.3 -> latest).

Solution 1

I had a similar error type. First, I tried to add the meta tags in the code, but it didn’t work.

I found out that on the nginx web server you may have a security setting that may block external code to run:

# Security directives
server_tokens off;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'  https://ajax.googleapis.com  https://ssl.google-analytics.com https://assets.zendesk.com https://connect.facebook.net; img-src 'self' https://ssl.google-analytics.com https://s-static.ak.facebook.com https://assets.zendesk.com; style-src 'self' 'unsafe-inline' https://assets.zendesk.com; font-src 'self' https://fonts.gstatic.com  https://themes.googleusercontent.com; frame-src https://player.vimeo.com https://assets.zendesk.com https://www.facebook.com https://s-static.ak.facebook.com https://tautt.zendesk.com; object-src 'none'";

Check the Content-Security-Policy. You may need to add the source reference.

Solution 2

I got around this by upgrading both the version of Angular that I was using (from v8 -> v9) and the version of TypeScript (from 3.5.3 -> latest).

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also Read

Leave a Comment