We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 47c5d2f commit 0712077Copy full SHA for 0712077
src/fetch_response.js
@@ -62,7 +62,7 @@ export class FetchResponse {
62
}
63
64
get isScript () {
65
- return this.contentType.match(/\bjavascript\b/)
+ return this.contentType.match(/\b(?:java|ecma)script\b/)
66
67
68
async renderTurboStream () {
@@ -80,6 +80,9 @@ export class FetchResponse {
80
async activeScript () {
81
if (this.isScript) {
82
const script = document.createElement('script')
83
+ const metaTag = document.querySelector("meta[name=csp-nonce]");
84
+ const nonce = metaTag && metaTag.content;
85
+ if (nonce) { script.setAttribute("nonce", nonce) }
86
script.innerHTML = await this.text
87
document.body.appendChild(script)
88
} else {
0 commit comments