News for hackers. Stuff that matters.
Re:Living without the modern browser by __ryan__ on Wednesday July 10, 2019 @10:00AM (#20401991)
> Really, there is no reason why a form should require JavaScript.

I’m a web developer who has never done significant forms without JavaScript.

So I’m curious: how would you handle reactive form fields without client side scripting? For example (perhaps a bad example): the user is entering data in “rows”. The user clicks “add row” and then a new row of fields appears. The user can also delete rows on a whim. Their changes should only be persisted once submit is clicked.

Would the “right” way be a full page reload with the row added/deleted, and caching all the values?

Not to mention, if fields require cross validation, is it customary to have to submit the form to get the validation error messages to occur? On some of the forms I’ve worked on, this would be very complex.

Re:Living without the modern browser by deanclatworthy on Wednesday July 10, 2019 @10:10AM (#20402077)
Split the form into pages, and use session variables to maintain state. Regarding form fields appearing and all your fancy front end logic: none of this would fly in user testing.

I find it mind-boggling there’s a generation of developers after me that doesn’t know the basics of server side state. No offence intended to yourself, and good on you for putting yourself out there to ask :)

Re:Living without the modern browser by hn_throwaway_99 on Wednesday July 10, 2019 @10:27AM (#20402246)
As a web developer for the past 20 years, I do know how server-side state works. What baffles me is that, while there is certainly much to complain about the state of front-end JS dev today, the attitude of some that moving the web back 15 years is a good thing.

There is a reason single-page apps became a thing, so I'm not clear why you think a page refresh for every user interaction is somehow a good thing. The dismissive attitude that "Regarding form fields appearing and all your fancy front end logic: none of this would fly in user testing" flies in the face of how 90% of heavy consumer front ends out there work today.

Re:Living without the modern browser by Dunedan on Wednesday July 10, 2019 @12:36PM (#20403620)
> There is a reason single-page apps became a thing, so I'm not clear why you think a page refresh for every user interaction is somehow a good thing.

So the reason I always hear is performance: Less HTTP-requests, less latency, therefore better user experience. While that might be the case for flaky mobile connections (although executing lots of Javascript on resource constraint devices might not be the best idea either), with fast wired connections I experience the opposite: The single page apps of today feel a lot slower to me, than the websites with the same functionality did 10 years ago, thanks to all the computation which has to be done on client side. Just take Youtube for example: What a bad experience nowadays, especially with Firefox. That was way better back in a time when they didn't try to avoid page refreshes. And it's not just Youtube, it's all over the web. A welcome change to all of that is HN, because it still feels as fast as websites did, before frontend development was even a thing.

Re:Living without the modern browser by away_throw on Wednesday July 10, 2019 @07:04PM (#20407492)
You can disable the new polymer layout for YouTube on Firefox using a console command. It brings back the old layout which is much faster and more functional.
Re:Living without the modern browser by anderspitman on Wednesday July 10, 2019 @08:12PM (#20407924)
Performance of JS is much more controllable than round-trip latency.
Re:Living without the modern browser by eitland on Wednesday July 10, 2019 @12:19PM (#20403395)
> the attitude of some that moving the web back 15 years is a good thing.

Straw man. We don’t want to go 15 years back, only 10 :-)

Seriously, the web was at a local maximum around 2009. Google worked, GMail was OK, Ajax was expected for r new stuff but was still written with graceful degradation in mind.

Re:Living without the modern browser by saagarjha on Wednesday July 10, 2019 @11:28AM (#20402886)
> What baffles me is that, while there is certainly much to complain about the state of front-end JS dev today, the attitude of some that moving the web back 15 years is a good thing.

The problem is that many people, for various reason (accessibility, poor network connection, low-end hardware, etc.) are stuck "in the past" with regards to the web. This doesn't mean you have to make this the experience for everyone using your website: just make sure it degrades gracefully for those who can't use the new shiny stuff.

Re:Living without the modern browser by RussianCow on Wednesday July 10, 2019 @12:05PM (#20403266)
This is often much easier said than done. Graceful degradation isn't free, and for many types of applications, simply isn't worth the effort to support.
Re:Living without the modern browser by saagarjha on Wednesday July 10, 2019 @12:25PM (#20403470)
> Graceful degradation isn't free, and for many types of applications, simply isn't worth the effort to support.

I hate to say it, but you're essentially saying "we can't afford to support people who are disabled, cannot afford the newest hardware, or are simply driving through a place with poor reception".

Re:Living without the modern browser by RussianCow on Wednesday July 10, 2019 @12:59PM (#20403852)
Yes, unfortunately that's exactly what I'm saying. In a perfect world, every app would be fully accessible, colorblind-friendly, work offline, etc etc. But in reality, all of those things cost money, and sometimes the cost outweighs the benefits. To give an extreme example, if my app has 1 million users, but only one is blind, do you expect me to spend (potentially significant) development resources on that single user?

You have to do that cost-benefit analysis based on how important those things are to your business—for instance, screen reader support is an absolute necessity for the public sector and certain information-heavy apps, but probably not as important for visual tools.

Re:Living without the modern browser by mankeysee on Wednesday July 10, 2019 @03:18PM (#20405422)
It's absolutely ridiculous how some content based websites require several MB of js to function. And the devs say this is because it is 'easier' to write such apps. And if the thought of optimization even comes to their minds, its just adding another layer on top of this madness to manage the layers below, or saying its too hard. Of course it is hard if you start with an overcomplex solution in the first place and try to trim away stuff from it. How hard exactly is it to write some plain html and css, with js doing some optional improvements? Most problems of web development are self inflicted.

I was talking to someone once about how ridiculously bloated Imgur is and that I had to use Imgoat because of the slow internet I was experiencing then. Of course they were trying to make all kinds of excuses like imgur not having servers nearby etc. But of course the really simple fact couldn't get to their heads that Imgur downloads like what 2-3 MB maybe even more of crap minus the actual image whereas Imgoat is something like 500 KB. No amount of network optimizations and caches etc are going to get over this fact. And also, such optimizations are over and above the page download size improvements anyways. If Imgoat used such techniques it'd be even faster. Most importantly: both sites have the exact same and simple core function, yet one site is so many times more bloated than the other. I will let you derive your own conclusions as to what this means.

And imgur also has the typical horrendous js misuses such as scrollbar hijacking that makes absolutely no sense etc.

Re:Living without the modern browser by jacobr on Wednesday July 10, 2019 @03:55PM (#20405866)
There is nothing limiting a disabled person’s browser from executing JavaScript, screen readers are generally not concerned with how an HTML element was created (server side or client side), but just read what’s on the page.
Re:Living without the modern browser by endless1234 on Wednesday July 10, 2019 @12:25PM (#20403472)
>just make sure it degrades gracefully

Okay, example: client pays me to make an somewhat interactive website. Client wants it to be done using React as that is easy to get other devs for in the future, if the need arises. Client doesn't want to pay double (random estimate) to make everything behave in e.g. Lynx. Do I do it out of pocket, or just say no to the client?

Re:Living without the modern browser by OldSchoolJohnny on Wednesday July 10, 2019 @01:07PM (#20403956)
Yeah there are a lot of ivory tower developers here with little to no real world experience and have never done anything of any substance or complexity pushing their tiny limited experience and knowledge and you can spot them from miles away in these comment sections. Those of us who work in the real world know how silly some of these comments are.
Re:Living without the modern browser by saagarjha on Wednesday July 10, 2019 @02:23PM (#20404784)
Please don't post personal attacks here; they contribute nothing to the discussion.
Re:Living without the modern browser by saagarjha on Wednesday July 10, 2019 @12:44PM (#20403713)
I think you have a duty to your client to tell them why they should be paying you double to do the job right. If they don't, well, Hacker News is full of people like me to shame them for excluding people from using their website.
Re:Living without the modern browser by spookthesunset on Wednesday July 10, 2019 @03:01PM (#20405249)
> If they don't, well, Hacker News is full of people like me to shame them for excluding people from using their website.

And the absolute number of HN people like you shaming folks for not supporting text-mode browsers like lynx is a rounding error for most websites.

Re:Living without the modern browser by extra88 on Wednesday July 10, 2019 @06:29PM (#20407265)
Develop with React but use something like Next.js to do Server Side Rendering (SSR)?
Re:Living without the modern browser by mankeysee on Wednesday July 10, 2019 @03:13PM (#20405369)
Theres a huge spectrum between SPAs and pure js-less apps.
Re:Living without the modern browser by malvosenior on Wednesday July 10, 2019 @10:33AM (#20402314)
Single-page apps became a thing because of lack of development resources to build native apps or properly engineer server side solutions (as well as a business desire to centralize and lock down the product so people have to experience ads, pay subscriptions...). It has nothing to do with creating a user friendly experience. 100% of the time a user would benefit from a native app or properly engineered server-side rendered web page over a SPA.
Re:Living without the modern browser by RussianCow on Wednesday July 10, 2019 @12:13PM (#20403354)
> It has nothing to do with creating a user friendly experience.

This is absolutely not true. Think about any kind of dynamic dashboard or data management platform. Having full page reloads for any minor change to filters, etc, is simply an unacceptable UX. But it has to be web-based because you need to be able to access it from any device, anywhere, without installing an app.

Plus, on a personal level, there are many services for which I will never install a native app—because I don't use it often, or because the native app provides no added benefit, or for one of a hundred other reasons. Those services don't get my business if they don't have a web app.

Re:Living without the modern browser by dredmorbius on Wednesday July 10, 2019 @02:32PM (#20404887)
That is a significant, but limited-use, case.

Theere's no reason a static contnt page must require JS Simply to render text, with a blank page as fallback.

Better ways of addressing the dashboaard example might be worth considering.

Too: bullshit dashboards with JS-based fakery;

https://www.theverge.com/2016/11/8/13571216/new-york-times-e...

Re:Living without the modern browser by RussianCow on Wednesday July 10, 2019 @05:35PM (#20406826)
Limited? That describes about half the applications I've built in my career!

In all seriousness, there is a big difference between static content pages and full-blown applications; the cost to make the latter work properly without JS enabled is almost never worth it. But the same is true even for some static pages; for instance, I would never expect that NY times election forecast page to work without JavaScript, and don't see any reason that it should. (The "JS-based fakery" is pretty irrelevant to the discussion, IMO.)

Re:Living without the modern browser by dredmorbius on Wednesday July 10, 2019 @09:24PM (#20408313)
What fraction of all HTML pageloads?

And: Sampling bias. A simple static page shouldn't require development. Hence, anyone doing web dev will have experience skewed strongly to more complex designs.

How would you describe the basic underlying structure and mechanics of a typical app you've built?

Re:Living without the modern browser by JumpCrisscross on Wednesday July 10, 2019 @11:10AM (#20402690)
> 100% of the time a user would benefit from a native app

I strongly prefer single-page web apps over native apps. Web apps are constrained by my browser. Native apps get a lot more trust.

Re:Living without the modern browser by AnIdiotOnTheNet on Wednesday July 10, 2019 @01:44PM (#20404379)
That's a problem we should have fixed on the platform side long ago, but didn't. Now we're stuck with the garbage fire of the modern web. That doesn't make it better.
Re:Living without the modern browser by hombre_fatal on Wednesday July 10, 2019 @11:33AM (#20402934)
I have uBlock Origin on my browser. I can even change the font-size on a web page if I need to. A native app can be doing anything it wants without my knowledge, and I can't even change the font-size.

Native apps have a performance benefit at the expense of everything we take for granted on the web, like being able to open up a developer console and inspect it.

For example, I noticed that the top language translation app on the Mac App Store incurs a Google Analytics request for every keystroke. And since there's no easy network tab I can open on any app, I only found it out because I was curious how it worked and mitm'd it with a proxy. And I couldn't just toss uBlock Origin at it to de-trackify it like I can any web app.

Doesn't seem like a 100% epic win for users to me. In fact, the only upside I can even think of is that it probably uses less RAM than a Chrome tab opened to Google Translate. Let's slow down and acknowledge the trade-offs before we go all-in on HN memes like native app superiority.

Re:Living without the modern browser by syntheticcdo on Wednesday July 10, 2019 @11:12AM (#20402711)
> 100% of the time

Nothing in software engineering is absolute. And even if something were to be 100% the correct solution one day, the next it could change.

Re:Living without the modern browser by ScottFree on Wednesday July 10, 2019 @11:31AM (#20402917)
I agree, but there is one problem: most people would rather use an SPA than have to download an app and have to keep it up to date themselves.

I wonder if there's a market for an alternative "browser" that loads "native" code (or as close as practically possible) and runs it in a sandbox.

Re:Living without the modern browser by mftrhu on Wednesday July 10, 2019 @06:50PM (#20407404)
> I wonder if there's a market for an alternative "browser" that loads "native" code (or as close as practically possible) and runs it in a sandbox.

This is probably not what you had in mind, and I'm not sure how good it would be at sandboxing, but REBOL Reblets imho come close to this <http://www.rebol.com/reblets.html>

Re:Living without the modern browser by greggirwin on Monday July 15, 2019 @11:03PM (#20447166)
The question is what "browser" means. If viewing data connected by hyperlinks is the goal, that's pretty easy. Rebol's approach to X-Net (Executable Internet) apps is very different, with the goal of being a way to share both data and active content. You can do both, the web we know just wasn't designed for that.
Re:Living without the modern browser by eitland on Wednesday July 10, 2019 @12:13PM (#20403353)
> I wonder if there's a market for an alternative "browser" that loads "native" code (or as close as practically possible) and runs it in a sandbox.

Electron comes close, but many don’t like it at all. (I have somewhat mixed experiences, I love VS Code but I’m not too fond of Slack.)

Re:Living without the modern browser by ScottFree on Wednesday July 10, 2019 @12:21PM (#20403419)
Electron isn't native in any sense of the word. I meant something more like OS-specific binary executables that get loaded and executed in a sandbox.

Mike Acton once said something about having created a browser plugin his team used that loaded and ran binary exe tools on demand, but that it was also wildly insecure. At least I think he said something like that. My memory could be wrong about that.

Re:Living without the modern browser by icedchai on Wednesday July 10, 2019 @07:39PM (#20407719)
We had this 20 years ago with Java (not native obviously) and ActiveX (Windows x86 only.)
Re:Living without the modern browser by favorited on Wednesday July 10, 2019 @03:26PM (#20405514)
> most people would rather use an SPA than have to download an app and have to keep it up to date themselves

Citation?

Re:Living without the modern browser by ScottFree on Wednesday July 10, 2019 @06:20PM (#20407205)
> Citation?

No.

Re:Living without the modern browser by hn_throwaway_99 on Friday July 12, 2019 @09:27AM (#20420495)
Hah, you mean Java applets? Everything old is new again.
Re:Living without the modern browser by ScottFree on Friday July 12, 2019 @09:36AM (#20420569)
I meant something more like OS-specific binary executables that get loaded and executed in a sandbox.
Re:Living without the modern browser by hombre_fatal on Wednesday July 10, 2019 @11:24AM (#20402854)
Since they specifically point out back-end state and full page reloads as an option, they're clearly asking from a place of incredulity. As in, "Wait, HNers actually think this is good UX?"

And no, moving client-side logic to the back-end isn't self-evidently superior. Not for your implementation nor for user UX. So you'd have to use more than condescension to make your point. Full page reloads for an "Add Row" button died for more reasons than just "web developers are idiots and don't realize how everyone actually loved that."

Re:Living without the modern browser by ebiester on Wednesday July 10, 2019 @11:06AM (#20402632)
Until someone presses the back button. :)

I find it mind-boggling that people forget the hell of flash scope and the back button and broken history and POST-redirect-GET. Session state was miserable and the best thing about SPAs is avoiding that.

Re:Living without the modern browser by icedchai on Wednesday July 10, 2019 @11:45AM (#20403052)
The truth is SPAs have to re-invent all of that on the client side. More SPAs have broken back button and history than server side apps ever did.
Re:Living without the modern browser by zonidjan on Wednesday July 10, 2019 @11:17AM (#20402782)
Yes. Use JavaScript for adding rows and validation, and fallback to new requests for both tasks if JavaScript is disabled. This is not difficult to do.
Re:Living without the modern browser by davnicwil on Wednesday July 10, 2019 @11:27AM (#20402877)
It's not difficult to do, I agree, but time spent doing it, testing it, maintaining it carries the opportunity cost of doing other things that may be more valuable.

Usually, such things are in abundance and take priority over supporting browsers without JS. For the vast majority of apps and businesses, JS as a minimum entry requirement is a perfectly acceptable tradeoff of lost users vs additional development cost.

Re:Living without the modern browser by zonidjan on Wednesday July 10, 2019 @11:40AM (#20403000)
I don't disagree. Heck, all of the websites I maintain for work require JS (although to be fair I also control the requirements for users: the latest version of Firefox or Chrome). I do wish the cost of requiring JavaScript was higher, though.
Re:Living without the modern browser by davnicwil on Wednesday July 10, 2019 @12:00PM (#20403213)
Genuinely interested, not assuming/implying I'm right - why?

I think just insisting on JS is, for most applications, the best thing for the most people. If the app is such that it has maximum availability as one of its top goals (government public service, public infrastructure, bill paying etc) I completely get it, but otherwise I'm just not convinced that not requiring JS is somehow inherently good.

If you'll allow a pretty weak analogy, it's almost like refusing to use a car and insisting upon using a horse and cart. You may have your own good reasons for doing that, and that's completely fine, you are free to make that choice, but you absolutely should expect the modern roads not to cater to you, and to be very often inconvenienced. Indeed, you shouldn't really expect society to spend lots of tax money catering to your choice and designing all roads, junctions, etc with it in mind, beyond the very minimum level so you can at least use the most important roads.

Re:Living without the modern browser by ptx on Wednesday July 10, 2019 @05:08PM (#20406571)
It's more like suggesting that perhaps sometimes walking is better than taking a car, while more fashionable developers insist on trying to use the car to go from the kitchen to the living room. And you still have to walk to the car.
Re:Living without the modern browser by zonidjan on Friday July 12, 2019 @01:08AM (#20418359)
I would use instead the analogy of a car and a bike. And indeed society does cater toward the bike, in many places.

But rather than any analogy, think about how many times more powerful a modern computer is than a computer from 2000. Now think about how many times more "things" you can do on that computer simultaneously. The latter is much smaller than the former.

Re:Living without the modern browser by dillonmckay on Wednesday July 10, 2019 @12:02PM (#20403232)
Well, it depends on who your users are and the regulatory requirements you are operating within.

A US college or university site can be sued for lack of Section 508 compliace.

So, it goes beyond development costs to legal risk of lack of compliance.

OTOH, a site selling cars probably does not need to worry about potential car-buyers using screen-readers.

Re:Living without the modern browser by davnicwil on Wednesday July 10, 2019 @12:10PM (#20403318)
As other comments have pointed out, there is no causal relationship between the use of JS and lack of accessibility, screen reader compatibility etc. So supporting no-JS and being accessible are two different concerns.

I'm absolutely all for accessibility and would never argue against making things accessible as part of some cost-based tradeoff. Frankly this shouldn't even be an issue that comes up if you 'just do things right' from the get go - but even if it does, the imperative is always on you to just fix it.

There might be a correlation where apps that happen to use JS are more likely to be written in a way which is less accessible by default, but that's another conversation.

With that out the way - totally agree with you, for certain apps with regulatory requirements insisting that JS not be required for use, that's what you do - and for good reason - max availability to anyone for public services etc - that makes complete sense.

Re:Living without the modern browser by dillonmckay on Wednesday July 10, 2019 @05:43PM (#20406918)
I don’t disagree.

The point I may have misunderstood is putting development effort into a SPA that only uses JS and works well with a screenreader versus the non-JS alternative that also works well with a screenreader.

Of course, it depends on where in the development process the developer becomes ‘aware’ of making the site compliant.

As you said, ‘do the right thing from the get go’.

Re:Living without the modern browser by AtticusTheGreat on Wednesday July 10, 2019 @10:23AM (#20402204)
In the old days the user would submit the form, the validation would happen on the server, then return a result. If the result was a failure, you would render the errors on a new page load. If the result was a success, you could redirect the user to "confirmation" page or reload the same page but with a different output.
Re:Living without the modern browser by shkkmo on Wednesday July 10, 2019 @02:44PM (#20405047)
> I’m a web developer who has never done significant forms without JavaScript.

Perhaps you should give it a try and learn how to do it. That way you'll know when building non-js fallbacks is feasible and how do it easily.

> is it customary to have to submit the form to get the validation error messages to occur?

You trust the client to perform validation? Client-side validation should only be used to improve UX, not as a substitute for server-side validation.

Re:Living without the modern browser by pmoriarty on Wednesday July 10, 2019 @01:11PM (#20403996)
99% of the forms I run in to in the wild are one-page forms without any interactivity, and just a single "Submit" button. Yet these web sites usually require Javascript (usually for tracking and ad delivery).

Something like 90% of sites I run in to deliver static content, yet almost all use Javascript (again, for tracking and ad delivery).

Fortunately, the overwhelming majority of these sites still work great or at least good enough without Javascript.

Most sites out there really have no legitimate need for Javascript, with the exception of truly interactive sites like ones that let you play games in the browser, let you use some sort of application (like a spreadsheet, word processor, graphics program, or, arguably, web mail) in the browser, or do something like let you see live updates of things like stock tickers. But most sites are not like this. They just serve static content that could be served up just as well or even better without JS.

Re:Living without the modern browser by c22 on Wednesday July 10, 2019 @09:50PM (#20408465)
> Would the “right” way be a full page reload with the row added/deleted, and caching all the values?

I don't know if this is the "right" way, but it sure sounds like a more reasonable fallback for clients without JS than serving them a blank page.

Re:Living without the modern browser by mixmastamyk on Wednesday July 10, 2019 @11:41AM (#20403011)
The main article was talking about login forms, posting comments, and other simple use cases.
Re:Living without the modern browser by slim on Wednesday July 10, 2019 @12:28PM (#20403514)
I would add a new @type property to table elements and publish it as HTML6 standard. @type=reactive would let you add/delete rows in the table.
Re:Living without the modern browser by malvosenior on Wednesday July 10, 2019 @10:08AM (#20402063)
> Would the “right” way be a full page reload with the row added/deleted, and caching all the values?

If the user didn't have Javascript enabled, then yes.

You'll have to do the validation server side anyway, client side scripting is just a "nice to have" it shouldn't be mandatory.

There are also probably too many people using the web to build applications that should be native.

Re:Living without the modern browser by danShumway on Wednesday July 10, 2019 @10:36AM (#20402360)
> There are also probably too many people using the web to build applications that should be native.

I hear this a lot, but I'm personally glad I don't need to download an app to my phone/computer to order pizza or find directions.

Obviously this is a balance, but of the two extremes that could exist, having too many web-apps seems to be better than having too few. The quickest, simplest step you can take ATM to improve your device security is to install fewer apps -- particularly if you use an OS like Android.

It's not clear to me that situation would get any better if half of the web disappeared.