-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheader.js
More file actions
20 lines (20 loc) · 703 Bytes
/
header.js
File metadata and controls
20 lines (20 loc) · 703 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
document.addEventListener("DOMContentLoaded", function() {
fetch("header.html")
.then(response => {
if (!response.ok) {
throw new Error("Network response was not ok " + response.statusText);
}
return response.text();
})
.then(data => {
const headerPlaceholder = document.getElementById("header-placeholder");
if (headerPlaceholder) {
headerPlaceholder.innerHTML = data;
} else {
console.error("Header placeholder not found.");
}
})
.catch(error => {
console.error("Failed to fetch header:", error);
});
});