Why do Discourse forums require JS?

Why do these forums require JavaScript? It’s not like other forums could work without it.

1 Like

Because Discourse is basically pure JavaScript. If you take JS away there is nothing left :wink:

Different technically solution, nothing else.

3 Likes

It’s just the way it’s made. Discourse doesn’t simply “needs” javascript, it IS a javascript application that is entirely loaded in your browser, and this application uses the API to load data from the server-side database.


@Jagster was faster. Also, my explanation may be a bit vague, but I’m sure there are experts here that will be able to explain it better!

5 Likes

This deserves some elaboration.

For a start:

:thinking: :eyes: GitHub - discourse/discourse: A platform for community discussion. Free, open, simple.

image

Discourse is actually mostly Ruby on Rails, and (according to GitHub) only a quarter of it is javascript, though it’s an extremely critical quarter and dominates the client side.

The reasons why Discourse and other modern websites(/webapps) use Javascript are:

  • workload: relieves the server from a lot of work so helps the website scale better (hey, get the users machine to share some of the work, why not?!)
  • bandwidth: although the initial load might be slightly longer to bring down that javascript, the interstitial loading of data from then on is MUCH faster using FAR less bandwidth (if the world lost javascript tomorrow, the internet would possibly grind to a halt?), because you only have to transfer the data and not all the markup and layout of all the UI. So things get done over the web so much quicker and enables low bandwidth connections like bad mobile connections.
  • UI: improves the dynamic nature of the UI so the user experience is better (e.g. click a button to update only a portion of the screen - no big whole browser repaints).
  • its a standard: Javascript is a standard on all modern browsers, including mobile ones so it’s write once and bring app like qualities to the majority of devices.
  • separation of concerns: decouples the server processes from having to worry about rendering the UI (usually) so easier to migrate to or support other front ends that may not be javascript (or even HTML) based. iOS app, anyone?

I’m sure there are plenty of other advantages but those are the basic ones.

12 Likes

From client’s side and for an end user it is pure JS, or looks that way, right?

3 Likes