May 18, 2023, 7:53am
proposal add options param to registerJs() like in registerJsFile().
In my case I want add nonce (Content-Security-Policy) to inline script tag.
Expected result is
<script nonce='same val'></script>
or may be somebody now how can I add nonce to inline script regitred via registerJs() ?
May 18, 2023, 10:29am
Please read the doc first always.
registerJsFile($url, ['nonce' => 'same val'])
May 18, 2023, 10:33am
I khow that registerJsFile can do.
I proposal add that ability to registerJs()
May 18, 2023, 10:41am
I’m sorry, you are right.
As you see it’s not possible now, it would require changing the
render* methods in
View component. The need for that feature is not that big so I would rather suggest using
Html::script() directly in the view file.
May 18, 2023, 11:07am
Bizley, thank you for your answer.
I think it would be nice if they add it in future versions,
because the requirements for seo are growing