DEV Community

Discussion on: Why your website should work without JavaScript.

Collapse
 
alidhuniya profile image
Ali Hussain Dhuniya

well, how do you fetch data without js(fetch)?

Collapse
 
shadowfaxrodeo profile image
Nathaniel

Well you can still get data from the server, you just have to serve it in a new page. There's some things that will be a nightmare without js, but you can take it far — here's a chat app built with just css and html

Collapse
 
alidhuniya profile image
Ali Hussain Dhuniya

can you elaborate more on this statement(if possible refer me to some demo or articles) " you can still get data from the server, you just have to serve it in a new page" and in your chat app you have used HTML form with POST method not GET method. I don't know why chat app site keeps loading page infinity, the finish time on network tab is not stopping at all. site reload whole webpage whenever I hit submit post, unlike fetch/xmlhttprequest.

Thread Thread
 
shadowfaxrodeo profile image
Nathaniel

Sure, I just mean to say that if js isn't availble you can always use the native html forms to send and receive data. It just requires a page load.

There are other hacky ways of doing a fetch without a refresh or navigating to a new page. I actually sent you the wrong link before, I can't find a live version of the one I meant to send: Github - CSS only chat

...but that's a deliberately ridiculous example.

In reality there are times you just can't do without javascript. In those times, you should have a reasonable fallback. For example, Google Sheets, doesn't work without js. But, if you try to access a sheet with js switched off, you still get to see a static version of the document.

Thread Thread
 
alidhuniya profile image
Ali Hussain Dhuniya

thanks for the clarification