google maps api script does load due to content security policy

后端 未结 3 650
滥情空心
滥情空心 2020-12-16 00:10

I am making a google chrome extension where I want to use google maps. The problem is that when I run my script then it gives me this error

Refused to load s         


        
3条回答
  •  我在风中等你
    2020-12-16 00:41

    I think the problem here is that you have not correctly set the content security policy for Google Maps URL. You should change your "content_security_policy" in manifest file to something like this:

    "content_security_policy": "script-src 'self' https://maps.googleapis.com https://maps.gstatic.com; object-src 'self'"
    

    This simply means that you are allowing to run script from the self/current page, and from the "https://maps.googleapis.com".

    Try this, and see if it helps.

提交回复
热议问题