Enabler to make scripts loaded from CDN more secure (#1127)
* added integrity property to load scripts * fix contributionpull/1124/merge
parent
8acb112e4e
commit
e83f3ebc66
|
@ -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>`;
|
Loading…
Reference in New Issue