-3

So recently I have come across a site known as "negafinity", I had looked at it as a normal site, until someone told me that the site was programmed using just JavaScript (presumed they had looked at their .js files). Site URL: https://negafinity.com/

So, is there any benefit in programming your website in full JavaScript? Rather than just programming it in plain HTML, CSS & JavaScript. If there is, what are the benefits? And what are the disadvantages?

EDIT: To not make it so broad, I am looking for these main factors:

  • Website Loading
  • Programming Time
  • Caching

Though, I am also on the look out for other benefits/disadvantages so please state them if you feel they are necessary!

iCodinqs
  • 1
  • 3
  • Possible duplicate of [Why do we need a Single Page Application?](https://stackoverflow.com/questions/16642259/why-do-we-need-a-single-page-application) – yuriy636 Sep 09 '17 at 21:15
  • Also [Single Page Application: advantages and disadvantages](https://stackoverflow.com/questions/21862054/single-page-application-advantages-and-disadvantages) – yuriy636 Sep 09 '17 at 21:16
  • Maybe you can read Rest VS Soap, it will make opinions by yourself – Kalamarico Sep 09 '17 at 21:16
  • @yuriy636 SPA's would not really relate to this question as they need not be fully constructed with JavaScript and can and are often built with static HTML and CSS in them. – Scott Marcus Sep 09 '17 at 21:27
  • For me, pure Javascript pages are great to make your sites more modular. It also doesn't mean you abandon CSS / HTML either,. for example I use webpack and do things like `require('./view.html')`.These HTML pages can be really small, and if they were loaded normally, would be very slow. IOW: For very large Application type websites, the Javascript approach just feels more extendable / maintainable. I also don't agree with performance, I would even go and say it's faster, not slower. You basically have more options for page loading. – Keith Sep 09 '17 at 21:34

2 Answers2

1

When an entire site is created solely with JavaScript, it is most likely because the final HTML and CSS (created by the JavaScript) will always need to be different based on certain conditions.

Those conditions could be something that can only be determined by what the situation is at the server.

Or, it could be based on the type or version of the client that is making the initial request (this would allow for the JavaScript to create proprietary HTML and/or CSS, but only when a certain kind of client makes the request).

Many sites rely heavily on content coming from databases (eBay is a very good example of this) and those sites will often just employ JavaScript to contact the server and get all the information needed and then construct the page based on smaller HTML templates.

In short, it allows for the entire page to be dynamically generated based on current conditions.

However, from a performance standpoint, it would be slower for pages to load this way than to have static HTML and CSS at least for the bulk of the page structure. It would most likely take considerably more time to code the page and less content would be cached.

With today's modern standards like CSS3 Media Queries, page content can be conditionally shown. And with AJAX, portions of a page can be conditionally generated as needed, rather than the entire page being built that way.

Scott Marcus
  • 64,069
  • 6
  • 49
  • 71
0

I don't think so. There's a reason why most sites use HTML or PHP with javascript.

AliBaba
  • 1
  • 3