Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
luojiandanPBI
Helper I
Helper I

Refused to connect to '......' because it violates the following Content Security Policy directive

hello everyone,

I need your help.

 

I use jQuery.js to get an *.json file,like this:

 

$.get("https://echarts.apache.org/examples/data/asset/geo/USA.json",
  function (json) {
     console.log('JSON Data:',json);
  }
);

 

luojiandanPBI_0-1697707613069.png

 

and I get error message in Web Console:

 

jquery.js:10099 Refused to connect to 'https://echarts.apache.org/examples/data/asset/geo/USA.json' because it violates the following Content Security Policy directive: "default-src https://app.powerbi.cn data: blob: 'unsafe-inline' 'unsafe-eval'". Note that 'connect-src' was not explicitly set, so 'default-src' is used as a fallback.

 

 luojiandanPBI_1-1697708139424.png

 

How can i do ? 

 

Thank you very much 

Best regards

2 ACCEPTED SOLUTIONS
dm-p
Super User
Super User

Hi @luojiandanPBI,

 

You will need to amend your privileges in your visual capabilities to allow web access from within the visual. Setting the domain you need should suffice, e.g.:

{
  ...
  "privileges": [
    {
      "name": "WebAccess",
      "essential": true,
      "parameters": [ "https://echarts.apache.org" ]
    }
  ],
  ...
}

 

This may not be exactly right but should help you move forward.

 

Note that the endpoint may have restrictions on accessing sandboxed iframes (which is how custom visuals are hosted). If this is the case, then you will need to check with the site owner if they can change their cross-domain policies (but bear in mind that site owners are usually reluctant to do this).

 

Regards,

 

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


My course: Introduction to Developing Power BI Visuals


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




View solution in original post

Hi,Daniel,you are right.

github is ok.

"https://*.githubusercontent.com"

 

Thanks again.

View solution in original post

4 REPLIES 4
dm-p
Super User
Super User

Hi @luojiandanPBI,

 

You will need to amend your privileges in your visual capabilities to allow web access from within the visual. Setting the domain you need should suffice, e.g.:

{
  ...
  "privileges": [
    {
      "name": "WebAccess",
      "essential": true,
      "parameters": [ "https://echarts.apache.org" ]
    }
  ],
  ...
}

 

This may not be exactly right but should help you move forward.

 

Note that the endpoint may have restrictions on accessing sandboxed iframes (which is how custom visuals are hosted). If this is the case, then you will need to check with the site owner if they can change their cross-domain policies (but bear in mind that site owners are usually reluctant to do this).

 

Regards,

 

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


My course: Introduction to Developing Power BI Visuals


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Hi,Daniel,you are right.

github is ok.

"https://*.githubusercontent.com"

 

Thanks again.

Brayancito2023
New Member

Do you prove chatgtp?

 

thanks for reply.

I try:

luojiandanPBI_0-1697769606400.png

but i don't know how to set 'connect-src' in my files.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors