Skip to content

Kirby 4.2.0


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

$kirby->nonce(): string

Return type


Parent class



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.