Skip to content

Commit

Permalink
remove elements from index.html when loading script or stylesheet fil…
Browse files Browse the repository at this point in the history
…es fails
  • Loading branch information
khassel committed Sep 11, 2024
1 parent 809a1ca commit 24ad5a5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions js/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ const Loader = (function () {
};
script.onerror = function () {
Log.error("Error on loading script:", fileName);
script.remove();
resolve();
};
document.getElementsByTagName("body")[0].appendChild(script);
Expand All @@ -193,6 +194,7 @@ const Loader = (function () {
};
stylesheet.onerror = function () {
Log.error("Error on loading stylesheet:", fileName);
stylesheet.remove();
resolve();
};
document.getElementsByTagName("head")[0].appendChild(stylesheet);
Expand Down

0 comments on commit 24ad5a5

Please sign in to comment.