4 ms·
The JavaScript annoyance will always be a part of web development at this point, but I really don't see why so many people use these single-page applications an
by JohnMH 10y ago
The JavaScript annoyance will always be a part of web development at this point, but I really don't see why so many people use these single-page applications and require JavaScript to perform simple tasks.
- sanderjd 10y agoBecause full page loads are a poor user experience for many actions a user can perform. The more such actions that are possible, the more it makes sense to build as a web application instead of a web site.
- kbart 10y agoWhat's wrong with an old school navigation bar and page segmentation? You really don't need JS to display simple blog or other text-mostly webpages.
- adrianratnapala 10y agoThey are a poor user experience because you don't want to have to load the whole text for cases where the user is only supposed to see some of it at first? If so: then does it make sense to download megabytes of JS libraries in order to save downloading 100kB of text?
- sanderjd 10y agoThat's not what I'm talking about. I'm talking about actions a user is taking. For instance, HN just performed a full page load for me to make this comment, and will do another one after I click "reply", and then I'll have to find my place again. That is sucky and would be much better implemented with javascript and a background POST. This is somewhat ok on HN because actions like commenting are much more rare than passively reading content (and because I find enough value in the commentary here that I'm willing to put up with quite a bit of suckiness), but it is a lot less ok for applications that are a lot more behavior based. To put it in concrete terms, I came to the conclusion that SPAs (or at least using javascript to implement most behaviors on individual pages of a multi-page application) make a ton of sense after spending a few years building an internal line-of-business application with a lot of behavior and not much content as a normal Rails multi-page app, noticing that the user experience was not great at all, and finding it to have very low return on investment to attempt to do it with progressive enhancement. We would have saved a lot of time and money by starting with a JS-based SPA approach for an application like that. If I were building a blog or news site, I suspect the opposite would be true.
- wtbob 10y ago> For instance, HN just performed a full page load for me to make this comment, and will do another one after I click "reply", and then I'll have to find my place again. That's why I comment in a new tab. But yes, I see that as an example where JavaScript could improve an HTML page — but that's no reason to make it impossible to use with JavaScript!
- smoe 10y agoI agree, that among other things, one should make it dependent on how the user interacts with the service. In think it makes perfect sense that apps like Slack, New Relic, etc. are SPAs. But in news/blog type sites for example, it often leads to worse user experience in my opinion. A lot of traffic (and for some sites probably the majority) is external, directly pointing to an article. In that case, I rather have a full page reload when i happen to click on a related article after reading than watching a spinner for second(s) every time I land on their page somehow.
- TazeTSchnitzel 10y agoA lot can be done without a new page load without using JS, and SPAs tend to break page loading altogether.
- sanderjd 10y agoWhat can be done without a page load without using JS? Are you talking about anchors or CSS animations or what?
- deleted 10y ago[deleted]
- TazeTSchnitzel 10y agoThose sorts of things. But also iframes are powerful.
- sanderjd 10y agoPowerful how? I'm struggling with the idea that it is possible to build the kinds of apps I spend most of my web time in using anchors, CSS animations, and iframes. I'm struggling even more with the idea that it might be worthwhile to try.
- UnoriginalGuy 10y agoBecause most sites won't work with JavaScript disabled regardless, and single page applications improve the user experience by dropping full page refreshes and replacing it with instant on-screen feedback. That being said, you do have to be careful or your site may break for people utilising accessibility technologies such as a screen reader.
- NoGravitas 10y agoIt's easy to get rid of full-page refreshes in a traditional many-page application with progressive enhancement with pjax. It's not very easy to go the other way, though.