From 00c82c8aee913faced17925be22997ea33b69ea3 Mon Sep 17 00:00:00 2001 From: Tommy Tan Date: Wed, 19 Aug 2020 05:16:40 -0700 Subject: [PATCH] Add nonce support --- src/fetch-jsonp.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/fetch-jsonp.js b/src/fetch-jsonp.js index 234af4e..4f8e4ad 100644 --- a/src/fetch-jsonp.js +++ b/src/fetch-jsonp.js @@ -59,6 +59,9 @@ function fetchJsonp(_url, options = {}) { if (options.charset) { jsonpScript.setAttribute('charset', options.charset); } + if (options.nonce) { + jsonpScript.setAttribute('nonce', options.nonce); + } jsonpScript.id = scriptId; document.getElementsByTagName('head')[0].appendChild(jsonpScript);