Hacker News new | ask | show | jobs
by wasmperson 27 days ago
> WHY javascript code is even allowed to see all these actions of the user?

scrolling: used by games, maps, image viewers

link navigation: used for client-side routing (youtube/twitch, any website with a chat window)

text selection and copy/paste: word processors, spreadsheet editors, forum software, etc.

I'm not sure if your question was sincere or if you were trying to say that the web should not support these use cases.

4 comments

Yes, you get to the heart of the problem - we turned what started of as a document viewer into a general purpose application platform.

Features paramount in a document viewer (broadly, "respect the user's local document viewing preferences") aren't desirable in a general purpose application platform.

A large number of companies/web developers don't think of themselves as offering the user a document to view on their own terms, but rather an "experience" that they want full control over (which means, most of the time: show ads and record user behavior).

If you're offering me a game, fair enough. But if you're showing me my hotel reservation or electric bill, I want a document, not an ""experience"".

Management wants you to want to have an experience.
nobody asked management.
And management asked nobody, and then did it anyway.

Your preferences are unusual. Most people either don't care or prefer flashiness over consistency.

It's something I've come to realise about the why the world is the way it is. Yes, to a certain extent it is because of locally maximal power structures and hierarchies propagating - but it is also because, taken as a whole, people are really just like that. A single politician may be corrupt, but that does not mean that most people, if taking their place, would not be as or more corrupt. Management sucks, yes - but that doesn't mean that most engineers who become managers wouldn't act the same way. You and I may prefer consistency over flashiness, but the majority of the world couldn't care less. So flashiness and "experiences" win.

A nerd podcast that I listen to was talking about shells and touched on Spaceship for zshell. One of the hosts talked about how having multi-line prompts became possible in the 90s, how it isn't new, but how packaging it up is new and now it's a trend for some people.

I'd previously found it interesting enough to try out for half a day. I've been back to my regular boring prompt ever since. Humans are attracted to shiny things. I innately understand why stuff like this is popular, even if I don't understand it intellectually / psychologically (I tried it because it looked cool; it didn't stick; what's different? I don't know, but I could talk a lot about it without really having a structured point.)

Yes, we've broken the intent of the browser. I'm sure there are better examples, but for me it was Google Maps. Oh my goodness, have you ever seen such a thing? It had to be impossible, but they did it. And from there, nothing was safe.

I don't think we can put the genie back in the bottle. There are things we can believe shouldn't be allowed in the browser. But breaking them would break things that people rely upon. Only pushing further to native apps (which I actually like on my desktop computer, phone is a walled garden) would make it possible and that's annoying as hell) could make it possible. Rambling. Just woke up. Please forgive.

You need no forgiveness, because your opinion is not a slight against me, others or any God.
On the extreme end, a web app can do all of its own rendering in a canvas with WebGL/WebGPU. Some apps do exactly this: Figma, Google Maps, Google Docs. Just to name a few. (edit: Earlier I claimed PDFjs uses canvas, but it does not. I was confusing it with Google Docs [1].)

It's a thing you can do. But it is very bad for extensions and extension developers for the same reasons that Java applets, Flash, and Shockwave were bad for the web. These apps are difficult for end users to customize. It's a real bane to tinkerers. And it's a shame that "view source" has slowly grown completely useless over the decades.

[1]: https://workspaceupdates.googleblog.com/2021/05/Google-Docs-...

I’m glad the era of Flash games existed. I’m glad it’s now possible to do all the same stuff in standard JS.
Why are HTML5/JS games so much laggier and buggier than Flash games?

Maybe it's not due to differences in the technologies used. I can imagine it's because less people make these games and spend less time per game to optimize it. Years ago there were thousands of flash games of each genre, a lot of them very well made, likely optimized for speed, pure works of art. Now I see the same 100 HTML5 games on all the sites, maybe reskinned a bit. I don't think we'll ever have in terms of quality as what was available on Kongregate or Armor Games.

I might download an old browser with Flash and some games. Years ago there was a collection of a few TB of Flash games, hope it's still around. Maybe some games that required network will not work, but most didn't.

Why are HTML5/JS games so much laggier and buggier than Flash games?

I’m not sure that’s actually the case.

Steve Jobs argued in his “thoughts on Flash” letter that Flash was too buggy, insecure and resource-hungry for mobile platforms. I worked on Chrome around that time and the Flash plugin was definitely one of the biggest sources of problems.

I think all the stuff you’re complaining about is to do with business models and not really anything to do with the technology. I reckon if Flash were still around we’d probably be in much the same place we are now. People would be complaining about restaurant menus being written in Flash instead of plain old HTML, etc etc.

I played Flash games 10-15 years ago on a 15 year old computer. I've tried HTML5 games on a 5 year old computer with a good CPU and lots of RAM, yet the experience doesn't compare at all. I doubt I'm looking through things with rose-colored glasses. I think I remember some games lagging, like if you'd spawned 1000s of enemies in a Tower Defense-type game, but that was very rare.

It's still likely that older games had more users so were optimized while newer games for Desktop don't have even 1% of that userbase since most people use a smartphone for simple games.

> scrolling: used by games, maps, image viewers

Out of curiosity, does anyone like the way Google Maps hijacks scrolling? I use a trackpad. When I scroll, I'd want it to pan around on the map, not zoom in and out (which always feels awful as a scroll action and never stops where I want it to).

Click-drag to pan doesn't feel nice.

It doesn't really matter anymore, since 99% of maps use is on mobile now, but this was always a small pain point to me in the past.

If you mean you prefer pinch/spread for zoom-out/in, I prefer the status quo with trackpad 2-finger scroll for zooming.

Pinching/spreading with index and middle finger feels unergonomic. Using my thumb on the trackpad would also feel unnatural, as would putting my 2 index fingers on the trackpad.

2 finger scroll is something you can "fling" such that the zooming motion continues even as your fingers have been lifted off the trackpad. Trying to "fling" a spread-out motion with your index and middle finger is an awkward motion, and of course in a pinching motion, your fingers would just crash into each other, so you'd have to lift before they crash. Pretty awkward.

On the phone, I often prefer tap then drag up/down (i.e. touch, lift, touch, slide) to zoom in/out with a single finger. It allows me to "fling" the zooming motion so it continues after I've lifted my finger. It makes a phone's interface behave like a trackpad's scrolling-zoom.

I never liked it either.

Panning by swiping feels so natural. That it breaks on a trackpad feels like a major oversight.

in my ideal world, the browser would ask to confirm "allow example.com to modify scroll behavior?" for all the potentially bad uses of javascript, like how current browsers ask you to allow microphone/multiple downloads/etc

does such a browser exist?