JavaShuo
拒绝执行内联事件处理程序,由于它违反了如下内容安全策略指令
时间 2020-08-13
标签
拒绝执行
内联
事件
处理
程序
由于
违反
如下
内容
安全
策略
指令
Refused to execute inline event handler because it violates the following Content Security Policy directive: “script-src ‘self’ ‘unsafe-inline’ ‘unsafe-eval’
at.alicdn.com
f.alicdn.com
g.alicdn.com
log.mmstat.com
g.assets.daily.taobao.net
g-assets.daily.taobao.net
tce.taobao.com
retcode.alicdn.com
g-assets.prepub.taobao.net
bim-core-prod.oss-cn-shanghai.aliyuncs.com
‘nonce-t0AOXmRYDuRMQrdp’”. Note that ‘unsafe-inline’ is ignored if either a hash or nonce value is present in the source list.
解决方案:
使用document 建立元素后,添加事件,而后插入到指定容器中,要注意,使用容器id,会形成id不惟一