-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Refused to load remote script in chrome extension script #535
Comments
I'm not an expert on CSP issues, but I think this could help: https://developers.google.com/maps/documentation/javascript/content-security-policy Note that we will reuse the nonce-value of the first script-tag that has one: react-google-maps/src/libraries/google-maps-api-loader.ts Lines 149 to 151 in 40b47d4
Maybe you can provide a link to the site where the problem occurs? |
Just noticed the part about this being in a chrome extension. I think I read somewhere that external scripts will no longer be supported in chrome extensions as of manifest version 3. Sadly, this also includes the google maps API. EDIT You might have to reach out to the Chrome Extensions DevRel folks to see if they can help you with what you want to achieve. |
if anyone is looking for an answer to a similar question, here's how I solved it:
|
I think it is important to note here that downloading the library-files and re-publishing them is very likely a violation of the Google Maps Platform Terms of Service (I am not a lawyer) and definitely something I would advise against, especially for commercial purposes. If you only need the Places and Autocomplete functions, it might be better to directly use the Places API via fetch and without the Maps JavaScript API and this library. |
Description
Refused to load the script 'https://maps.googleapis.com/maps/api/js?key=secret&language=en-US&solution_channel=GMP_visgl_rgmlibrary_v1_default&loading=async&callback=__googleMapsCallback__' because it violates the following Content Security Policy directive: "script-src 'self'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
failed to load the Google Maps JavaScript API Error: The Google Maps JavaScript API could not load.
at scriptElement.onerror (index.umd.js:182:1)
Steps to Reproduce
Environment
Logs
No response
The text was updated successfully, but these errors were encountered: