logoalt Hacker News

wasmpersontoday at 1:27 AM3 repliesview on HN

> 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.


Replies

gyomutoday at 2:09 AM

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"".

show 1 reply
jason_ostertoday at 2:09 AM

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-...

tiltowaittoday at 2:30 AM

> 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.

show 2 replies