In my html page I want to add footer
and header
for all the pages
This app need to run by opening the file and not with server running.
I add to my code
fetch('shared/header.html')
.then((response) => {
return response.text();
})
.then((html) => {
document.body.innerHTML = html
});
but I got cors error
Access to fetch at 'file:///D:/projects/javascriptApp/shared/header.html' from origin 'null' has been blocked by CORS policy:
How can I add shared html files into another file with vanilla javascript