Not able to update the entire website page when I run it in WebStorm?

I am simply creating a website using HTML CSS and JS. and I have one simply external JS File 

const fetchFooter = async () => {
const res = await fetch('footer.html');
console.log(res)
const data = await res.text();
document.querySelector('#footer').innerHTML = data;
}
fetchFooter();

 

and I am using it in all my pages using one line of code

<footer id="footer"></footer>

 

It is working in all pages. But the problem is when I run the index.html file it will work perfectly but the moment I click About on navbar the about page will not have the JS and CSS code included in it.. I have to run the about page again from editor then only it will work and then again from about if I click on Home menu, there home page will not have it.

I am sharing the two images, you will get idea what is happening with me.. In About page no Navbar no footer though I have written the code in it. But in Home Page it working perfectly fine. 


So how to run the website properly in WebStorm.

5 comments
Comment actions Permalink

please try running your page using the Debug action in the .html file right-click menu - what is printed to console? You can also use Chrome Dev Tools console to check if any errors are there

0
Comment actions Permalink

I did but still same problem. index.html is running perfectly but again when I clicked on about page it's same no css no js

 

0
Comment actions Permalink
This is a runtime error in your application, it doesn't seem to have any relation to the IDE
0
Comment actions Permalink

But it is there in WebStorm only not in any other editor like VS Code or Sublime. There it's working fine and with no TypeError.. I share my complete website zip file too in personal. Please have a look once and let me know.
Thank You

0
Comment actions Permalink

Your web site is designed to be hosted by web server that serves files from the server root; but WebStorm simple web server serves them from <root>/<project name>, like http://localhost:63342/untitled/index.html; any absolute URL (starting with leading slash) that tell the browser to resolve a link relative to web server root will result in 404 error, breaking the files loading

As re-designing the app means a lot of work, I'd suggest using other web servers to host your app

0

Please sign in to leave a comment.