Reference

Guide

$kirby->nonce()

Returns the nonce, which is used in the panel for inline scripts

$kirby->nonce(): string

Return type

string

Example

The method generates a nonce that you can use in your inline scripts in conjuction with the Content Security Policy of your website.

<script nonce="<?= $kirby->nonce() ?>">…</script>

You can also use it to configure a custom content security policy for your site and/or the panel.

Source code

kirby/src/Cms/App.php#L790