方法
实例公共方法
csp_meta_tag(**options) 链接
返回一个 meta 标签 “csp-nonce”,其中包含每会话的 nonce 值,用于允许内联 <script> 标签。
<head> <%= csp_meta_tag %> </head>
Rails UJS 助手使用此功能来创建动态加载的内联 <script> 元素。
来源: 显示 | 在 GitHub 上
# File actionview/lib/action_view/helpers/csp_helper.rb, line 17 def csp_meta_tag(**options) if content_security_policy? options[:name] = "csp-nonce" options[:content] = content_security_policy_nonce tag("meta", options) end end