Enabler to make scripts loaded from CDN more secure (#1127)

* added integrity property to load scripts

* fix contribution
This commit is contained in:
Michael Kolb
2024-10-25 10:38:37 +02:00
committed by GitHub
parent 8acb112e4e
commit e83f3ebc66
+7 -2
View File
@@ -90,9 +90,14 @@ function updateHeight() {
}
}
function loadJsByUrl(url) {
function loadJsByUrl(url,integrity=null) {
const script = document.createElement("script");
script.src = url;
if(integrity){
script.integrity=integrity;
script.crossorigin="anonymous";
}
return new Promise((resolve) => {
script.onload = resolve;
@@ -104,4 +109,4 @@ function loadJsByUrl(url) {
<body>
</body>
</html>`;
</html>`;