Skip to content

Kirby 3.9.8

$kirby->nonce()

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

$kirby->nonce(): string

Return type

string

Parent class

Kirby\Cms\App

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.