---
title: "Deprecation: #100887 - Deprecation of useNonce argument in f:asset:css and f:asset:script view helpers"
manual: "TYPO3 Core Changelog"
version: "main"
permalink: "https://docs.typo3.org/permalink/changelog:deprecation-100887-1774712028"
source: "Changelog/14.2/Deprecation-100887-UseNonceArgumentInFAssetViewHelpers.rst"
typo3-version: "14.2"
typo3-major: 14
type: "deprecation"
issue: 100887
forge: "https://forge.typo3.org/issues/100887"
tags: ["Fluid", "PHP-API", "PartiallyScanned", "ext:core", "ext:fluid"]
rendered: "2026-09-20T18:31:11+00:00"
---

# Deprecation: #100887 - Deprecation of useNonce argument in f:asset:css and f:asset:script view helpers {#deprecation-100887-1774712028}

See [forge#100887](https://forge.typo3.org/issues/100887)

## Description {#description}

The `useNonce` argument in the `f:asset.script` and
`f:asset.css` ViewHelpers has been renamed to `csp` to better
reflect its purpose (controlling Content-Security-Policy hash/nonce
collection rather than nonce usage specifically).

Similarly, the `'useNonce'` asset option key accepted by
`addJavaScript()` and `addStyleSheet()` in class
`\TYPO3\CMS\Core\Page\AssetCollector` has been
replaced by `'csp'`.

## Impact {#impact}

Passing `useNonce` as a ViewHelper argument or as an
`AssetCollector` option key will trigger
a deprecation-level log entry in TYPO3 v14. This usage is scheduled for
removal in TYPO3 v15.

## Affected installations {#affected-installations}

Installations with Fluid templates using `<f:asset.script useNonce="1">`
or `<f:asset.css useNonce="1">`, and extensions calling
`AssetCollector::addJavaScript()` or `AssetCollector::addStyleSheet()`
with `['useNonce' => true]`.

## Migration {#migration}

Replace the `useNonce` argument with `csp` in Fluid templates:

```html
<!-- Before -->
<f:asset.script identifier="my-script"
    src="EXT:my_ext/Resources/Public/JavaScript/foo.js"
    useNonce="1" />

<!-- After -->
<f:asset.script identifier="my-script"
    src="EXT:my_ext/Resources/Public/JavaScript/foo.js"
    csp="1" />
```

Replace the `'useNonce'` option key with `'csp'` in PHP:

```php
// Before
$assetCollector->addJavaScript('my-script', $src, [], ['useNonce' => true]);

// After
$assetCollector->addJavaScript('my-script', $src, [], ['csp' => true]);
```

The `PageRenderer` methods `addJsInlineCode()`,
`addJsFooterInlineCode()`, and `addCssInlineBlock()` retain their
`$useNonce` parameter names for backward compatibility. No migration is
required for callers of these methods.
