无法在Android设备上播放youtube视频

时间:2017-08-10 05:09:12

标签: javascript youtube youtube-api android-youtube-api content-security-policy

元数据

<meta http-equiv="Content-Security-Policy" content="default-src * data: filesystem: android-webview-video-poster:; style-src 'self' 'unsafe-inline' 'unsafe-eval' https://www.youtube.com;  script-src 'self' 'unsafe-inline' 'unsafe-eval'; font-src *;">

错误消息

VM772:712 Refused to load the script 'https://www.youtube.com/iframe_api' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-inline' 'unsafe-eval'"

1 个答案:

答案 0 :(得分:0)

将script-src替换为下面的代码段

script-src *

<meta http-equiv="Content-Security-Policy" content="default-src * data: filesystem: android-webview-video-poster:; style-src 'self' 'unsafe-inline';  script-src * 'unsafe-inline' 'unsafe-eval'; font-src *;">