Skip to content

Commit b93d098

Browse files
authored
Merge pull request #817 from rubenswieringa/fix/csp-nonce
Write nonce to <script> tag with setAttribute()
2 parents a89e173 + 4cc62a4 commit b93d098

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/gentle-melons-look.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'react-use-intercom': patch
3+
---
4+
5+
Repair nonces on <script> tags

packages/react-use-intercom/src/initialize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const initialize = (appId: string, timeout: number = 0, cspNonce?: string) => {
3232
var s = d.createElement('script');
3333
s.type = 'text/javascript';
3434
s.async = true;
35-
if (cspNonce) s.nonce = cspNonce;
35+
if (cspNonce) s.setAttribute('nonce', cspNonce);
3636
s.src = 'https://widget.intercom.io/widget/' + appId;
3737
var x = d.getElementsByTagName('script')[0];
3838
x.parentNode.insertBefore(s, x);

0 commit comments

Comments
 (0)