Enabler to make scripts loaded from CDN more secure (#1127)
* added integrity property to load scripts * fix contribution
This commit is contained in:
@@ -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>`;
|
||||
Reference in New Issue
Block a user