logoalt Hacker News

NooneAtAll3yesterday at 11:38 PM13 repliesview on HN

> Don't roll your own page scrolling.

browser should not even let the page see this action

> Don't roll your own link navigation.

browser should not even let the page see this action

> Don't roll your own text selection.

browser should not even let the page see this action

> Don't roll your own copy and paste.

browser should not even let the page see this action

I'm serious. WHY javascript code is even allowed to see all these actions of the user? We already loaded the page and rendered it - we users must already be free to do with the content as we please


Replies

wasmpersontoday at 1:27 AM

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

show 3 replies
incr_meyesterday at 11:50 PM

Because the web browser was burdened with the role of application host, and not just presentation of static content. There's no going backwards.

show 2 replies
js2yesterday at 11:46 PM

All of these annoyances and more can be blocked by StopTheMadness (available for iOS and macOS):

https://underpassapp.com/StopTheMadness/

show 2 replies
andaitoday at 12:06 AM

I found that most internet pages are greatly enhanced by disabling JavaScript in my web browser.

show 2 replies
vitally3643yesterday at 11:42 PM

It should be illegal for a website to hijack text copying, right clicking, or keyboard shortcuts like Ctrl*f.

show 1 reply
tecoholictoday at 1:25 AM

> WHY javascript code is even allowed to see all these actions of the user? We already loaded the page and rendered it

Nope we haven’t. At least not in a web application. At least not since the days Infinite Scrolling was invented. IIRC Twitter, for eg, only renders a partial list depending on the scroll position.

I once wrote a NER tagger, where implementing custom text selection allowed users to not stress about selecting the exact word boundaries when manually tagging 1000s of words per day.

I can probably find legitimate use cases for almost of these things in the list. While I agree with the broader theme of the article, this idea that the user agent should be a dumb display is not valid.

crq-ymltoday at 1:14 AM

The Web is an ads platform with useful functionality as bait.

That's all there really is to it: Mosaic added image support. Investors got excited and asked if the images could animate, if they could record click data and credit card data, if they could add video and additional presentational elements. Holistic user experiences were secondary.

To move forward we have to accept that most of this wasn't an accident and it needs some breaking changes.

jakevoytkotoday at 1:18 AM

Applications like Google Docs would be impossible without each of the four things you listed being available. We had Google Docs that didn’t roll-your-own for each of the items in that list and it was called Writely and it was absolute dogshit (but super cool for its time) because those limitations were too extreme. And by extension it wouldn’t make sense to have Chromebooks as a category of hardware, because web software could never compete at a feature parity level with native software.

show 3 replies
mslatoday at 12:02 AM

> WHY javascript code is even allowed to see all these actions of the user?

Because the alternative is UI/UX Designers and Visionary Managers insisting on keeping Flash and Java Applets and Microsoft Visual Silverlight .Net++ around forever, because you can't do some things in the browser and We Need To Do Them.

Some things have minimal complexity that either lives in the language itself or in libraries. The Web has minimal bells and whistles that are either implemented in the browsers itself or in plugins.

show 1 reply
manoDevtoday at 1:09 AM

Javascript was a mistake.

bigstrat2003yesterday at 11:50 PM

Also: Javascript should not be able to touch the browser history. I know it's useful for some apps. But it's too prone to abuse and that API should be revoked.

show 1 reply
kazinatortoday at 3:31 AM

Desktop envy: so you could create certain desktop-like interactions.

GolfPoppertoday at 1:07 AM

>WHY javascript code is even allowed to see all these actions of the user? We already loaded the page and rendered it - we users must already be free to do with the content as we please

Because on the modern web, the user is the content, sold to the highest bidder.