Skip to content

Usage of nonce in useLoadScript possible ? #2222

Answered by frandiox
iska31 asked this question in Help
Discussion options

You must be logged in to vote

For now, can you try with something like useLoadScript('...', {attributes: { nonce: useNonce() } })? The useNonce() hook should give you the same nonce.

Otherwise, if you are able to use the <Script> component instead of useLoadScript, it should inject the nonce automatically.


@blittle @wizardlyhel Should we wrap useLoadScript from Hydrogen-React and inject the nonce automatically in Hydrogen? I see this hook is used for analytics/customer-privacy and it's not injecting nonce at the moment.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@wizardlyhel
Comment options

@frandiox
Comment options

@iska31
Comment options

Answer selected by iska31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants