91
Elxis 4.x/5.x DEV / Re: Upcoming Elxis 5.6 information
« Last post by datahell on August 13, 2025, 09:42:16 »If you want to write javascript inside html body use the nonce attribute. The value of nonce can be retrieved from elxisDocument::getNonce() method (requires Elxis 5.6 or newer).
Example
<script nonce="<?php echo $eDoc->getNonce(); ?>">
javascript code here
</script>
To check if you have Elxis 5.6:
if ($elxis->getVersion() >= 5.6) {
...
}
The nonce attribute tells the browser that this piece of inline code has not been injected to the content by third parties and it is safe to execute. The value of nonce is cryptographic secure and it changes on every click. Elxis put the nonce value on document headers when using a CSP policy.
Example
<script nonce="<?php echo $eDoc->getNonce(); ?>">
javascript code here
</script>
To check if you have Elxis 5.6:
if ($elxis->getVersion() >= 5.6) {
...
}
The nonce attribute tells the browser that this piece of inline code has not been injected to the content by third parties and it is safe to execute. The value of nonce is cryptographic secure and it changes on every click. Elxis put the nonce value on document headers when using a CSP policy.

Recent Posts