I am learning javascript and I made a webpage with news API. the problem is that when I open my index.html file with the live server in vs code is working fine but when I go to my folder and open the HTML file the javascript is not working.
this is index.html in live server vs code working perfectly
this is image of same file when I open it from my folder
I am new to web development, not even new I am still a student. is it not supposed to work or am I doing something wrong?
CodePudding user response:
you need the development server to serve the statics files, such as images to browser. browser will request static files from the server, and loaded in browser. that is why without vscode liveserver, you do not see images.
CodePudding user response:
You are required to serve the files. use a tool like MAMP for that.
After startup you have to change the Webserver to the folder containing your index.html (Documentation)
If you are using a more complex framework additional steps can be required.