player.js: A bunch of errors "violates the following Content Security Policy directive: script-src 'none'"
We are getting a bunch of errors like this
What are we doing wrong? We are using simple iframes to render vimeo videos and these errors pop up in the console
` [Report Only] Refused to load the script ‘<URL>’ because it violates the following Content Security Policy directive: “script-src ‘none’”. Note that ‘script-src-elem’ was not explicitly set, so ‘script-src’ is used as a fallback.
888459704:34 [Report Only] Refused to load the script ‘https://f.vimeocdn.com/p/4.33.5/js/player.module.js’ because it violates the following Content Security Policy directive: “script-src ‘none’”. Note that ‘script-src-elem’ was not explicitly set, so ‘script-src’ is used as a fallback.
888459704:35 [Report Only] Refused to load the script ‘https://f.vimeocdn.com/p/4.33.5/js/vendor.module.js’ because it violates the following Content Security Policy directive: “script-src ‘none’”. Note that ‘script-src-elem’ was not explicitly set, so ‘script-src’ is used as a fallback.
888459704?h=c5387031da:107 [Report Only] Refused to load the script ‘https://f.vimeocdn.com/js_opt/modules/utils/vuid.min.js’ because it violates the following Content Security Policy directive: “script-src ‘none’”. Note that ‘script-src-elem’ was not explicitly set, so ‘script-src’ is used as a fallback.
window.loadScript @ 888459704?h=c5387031da:107 window.loadVUID @ 888459704?h=c5387031da:107 (anonymous) @ 888459704?h=c5387031da:118 Promise.then (async) (anonymous) @ 888459704?h=c5387031da:118 vendor.module.js:2 [Report Only] Refused to load the script ‘https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1’ because it violates the following Content Security Policy directive: “script-src ‘none’”. Note that ‘script-src-elem’ was not explicitly set, so ‘script-src’ is used as a fallback.
t.loadLibrary @ vendor.module.js:2 (anonymous) @ vendor.module.js:2 t.setup @ vendor.module.js:2 n.init @ player.module.js:2 (anonymous) @ player.module.js:2 (anonymous) @ player.module.js:2 j @ player.module.js:2 (anonymous) @ player.module.js:2 Promise.then (async) init @ player.module.js:2 hv @ player.module.js:2 (anonymous) @ 888459704?h=c5387031da:118 Promise.then (async) (anonymous) @ 888459704?h=c5387031da:118 cast_sender.js?loadCastFramework=1:10 [Report Only] Refused to load the script ‘https://www.gstatic.com/cast/sdk/libs/sender/1.0/cast_framework.js’ because it violates the following Content Security Policy directive: “script-src ‘none’”. Note that ‘script-src-elem’ was not explicitly set, so ‘script-src’ is used as a fallback.
E @ cast_sender.js?loadCastFramework=1:10 K @ cast_sender.js?loadCastFramework=1:11 (anonymous) @ cast_sender.js?loadCastFramework=1:11 (anonymous) @ cast_sender.js?loadCastFramework=1:12 cast_sender.js?loadCastFramework=1:10 [Report Only] Refused to load the script ‘https://www.gstatic.com/eureka/clank/125/cast_sender.js’ because it violates the following Content Security Policy directive: “script-src ‘none’”. Note that ‘script-src-elem’ was not explicitly set, so ‘script-src’ is used as a fallback. `
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 10
- Comments: 24 (5 by maintainers)
I’ve put together a jsfiddle that consistently reproduces the error. It occurs in ~1/20 loads which is why there are multiple iframes. It may require a page reload for it to appear
We confirm that the issue was indeed fixed! Thank you!
Thank you very much for working on this, and for coming back to tell us! I just got reminded about this issue precisely because I opened the dev console and saw no errors! 🎊
I’m currently having the same issue on a site I’m working on. We load a bunch of videos from vimeo using the embedded player in an iframe.
Most of the iframe requests come back with just the perfectly valid
Content-Security-Policyheader. However, some of the iframe requests also include aContent-Security-Policy-Report-Onlyheader with the e.g. the following value:It’s true that the errors are “Report-Only” and thus they don’t break functionality. Unfortunately, when iOS encounters a page with “a lot” of errors, it just shuts down the page saying “A problem repeatedly occurred on “thesite.com”” and that’s it.
I’m not sure if this has to do with some cloudflare setup injecting this, or if it’s 100% intentional, but it’s breaking the site. One solution would be to proxy all requests to vimeo, and configure the proxy to hide this header, but that’s probably a good way to get banned as a bot.