News for hackers. Stuff that matters.
Re:A day without JavaScript by VMG on Wednesday June 07, 2017 @08:16AM (#14505633)
> For me it’s a matter of elegance and simplicity over unnecessary complexity.

Simplicity is having one place where the DOM is created and managed, and optimizing for the 99% use case.

Complexity is splitting up DOM rendering over two networked systems for servicing a 1% use case.

Browsers are JS runtimes now. Get over it.

Re:A day without JavaScript by hobs on Wednesday June 07, 2017 @08:24AM (#14505687)
Naw, I will keep running noscript and blocking script by default.

If your site doesn't work, I don't care, I will go to a different one.

I may be the minority now, and while there is some great use of js out there; most of it is bloated, slow, insecure, and often privacy destroying.

Re:A day without JavaScript by madsbuch on Wednesday June 07, 2017 @08:35AM (#14505778)
Not all websites not using JS are good: http://www.theworldsworstwebsiteever.com/

It is not a question about JavaScript or not. It is a question about well developed site.

Re:A day without JavaScript by eberkund on Wednesday June 07, 2017 @11:20AM (#14507142)
At least that site loads quickly, doesn't call home with tracking info, or use up all of my expensive mobile bandwidth.
Re:A day without JavaScript by sp332 on Wednesday June 07, 2017 @11:49AM (#14507362)
According to my uBlock Origin plugin, this page does use Google Analytics and Easy Counter.
Re:A day without JavaScript by saltedmd5 on Wednesday June 07, 2017 @08:32AM (#14505754)
I honestly think the security/privacy arguments are the only valid argument against requiring JS as standard.

The idea of browsers sending data that the user has explicitly elected to send (in addition to, if we're being pedantic, that the server put there in the first place) is very compelling in this day and age - only problem being that in order for that to have any meaningful impact on web security in the general case, you'd have to more or less universally deprecate JS support, which would set the web in a very different direction indeed.

Re:A day without JavaScript by pasta on Wednesday June 07, 2017 @08:39AM (#14505810)
What about power consumption as another valid argument? Your battery will last longer without Javascript.
Re:A day without JavaScript by saltedmd5 on Wednesday June 07, 2017 @09:20AM (#14506152)
That would be a valid reason to provide a JS alternative depending on context, not so much a valid argument for JS-free alternatives as standard.

There will always be something you can do to reduce power consumption: expecting (or advocating) JS-free versions of all websites for that reason is a completely arbitrary line to draw.

Re:A day without JavaScript by VMG on Wednesday June 07, 2017 @08:42AM (#14505840)
It will last even longer without CSS
Re:A day without JavaScript by 4c2383f5c88e911 on Wednesday June 07, 2017 @08:51AM (#14505917)
And most websites that work without JS also work fine without CSS. Almost like a pattern that can be found in properly built websites.
Re:A day without JavaScript by cr0sh on Wednesday June 07, 2017 @12:18PM (#14507603)
You know - at one time we built plenty of websites - and in some cases applications - using little to no javascript (either it didn't exist, or it was only used for very minimal things) or any CSS (it didn't exist).

So what could we do today? That is - if we purposefully limited ourselves to just basic HTML, and server-side processing, without any (or minimal) CSS or javascript, and only using the (expanded) tag and attribute HTML we have today?

I don't know for sure - but I believe we could create some amazing things.

Think about it this way: Look at what demoscene people are able to create when they put extremely artificial challenges in front of themselves; we could try to do the same - and see what happens?

Perhaps there needs to be a demoscene-like competition space for this kind of stuff (how much can you get done in under 100k browser-side? 10k? 1k? Limit bandwidth to the backend, too, and maybe server-side size of code?).

Just some random thoughts - it might be something I'd have to try myself, but maybe this post might inspire someone to do it as well...

Re:A day without JavaScript by andai on Wednesday June 07, 2017 @03:52PM (#14509377)
What kind of things are you imagining people would get done with such a limitation?

Recently I was using an expensive mobile connection and I discovered w3m, a text based browser (runs in the terminal). I was amazed at how much faster everything worked.

Most of the sites were still perfectly usable (w3m has pretty good HTML rendering) but some were very difficult to navigate.

My point is, without JS and CSS, the web is just... text.

And when you browse with w3m you realize, that actually the web has always been text. It can be quite refreshing to get all the decorative crap out of the way.

--

edit: I now see you didn't say to remove JS, but to challenge yourself to see how much you can make in a tiny amount of JS. Such competitions exist!

web pages https://a-k-apart.com/

java games http://www.java4k.com/

Re:A day without JavaScript by computerex on Wednesday June 07, 2017 @09:22AM (#14506167)
WTF? You do realize most of the users on the internet don't even know what CSS/JS is and would be thoroughly displeased at being presented with a page with no styling. They don't appreciate that the rendering is done without JS/CSS. A properly built website is one that caters to most users, not developers or power users concerned about JS being enabled in 2017.
Re:A day without JavaScript by VMG on Wednesday June 07, 2017 @09:09AM (#14506054)
Why doesn't the market care? Where is the JS-less Facebook/Twitter/Airbnb competitor that blows the customers away with "properly built" websites?
Re:A day without JavaScript by gpderetta on Wednesday June 07, 2017 @09:24AM (#14506178)
As the number of people that won't put up with the JS crap anymore and start using JS blockers increase, we will see such websites.

Same thing that is happening with ads and ad blockers.

Re:A day without JavaScript by computerex on Wednesday June 07, 2017 @10:56AM (#14506932)
Ad blockers are now going in the other direction with non-intrusive ads being shown.
Re:A day without JavaScript by marssaxman on Wednesday June 07, 2017 @01:46PM (#14508363)
So far as I know there has been exactly one such ad blocker released, and it was promptly abandoned in favor of the kind of adblockers people actually want to use.

All ads are intrusive to some degree.

Re:A day without JavaScript by gpderetta on Wednesday June 07, 2017 @11:01AM (#14506983)
I would be extremely happy to use a JS block that allows non intrusive JS.
Re:A day without JavaScript by alexseman on Wednesday June 07, 2017 @02:26PM (#14508694)
Privacy Badger is what you're looking for.

https://www.eff.org/privacybadger

Re:A day without JavaScript by asfdsfggtfd on Wednesday June 07, 2017 @09:28AM (#14506213)
In the Facebook case this is supported by Facebook themselves. mbasic.facebook.com :)
Re:A day without JavaScript by accountyaccount on Wednesday June 07, 2017 @04:36PM (#14509659)
It will last longer without a screen too.
Re:A day without JavaScript by accountyaccount on Wednesday June 07, 2017 @04:35PM (#14509657)
>I may be the minority now,

You will also be in the minority later

Re:A day without JavaScript by Spivak on Wednesday June 07, 2017 @05:05PM (#14509873)
Sure, but the he only has to wait for the cycle to swing around again. Browsers will officially turn into JS/WASM runtimes. Sites will balloon until instant delivery is no longer feasible. Browsers will respond by allowing sites to version themselves to aggressively cache client code. Eventually browsers will start offering site-specific-browser features to 'new-modern' sites to combat the extreme waste of Electron and the like.

Someone with political capital and influence in the developer world will realize that the web is still mostly text and design a browser optimized for that use case. It will be hailed as a revolution and people will start preferring it over the 'old-web' for accessing static content like news.

Then under pressure from developers pushing the limits of static content they will include a simple, limited scripting language that promises to facilitate basic interactive elements and start the cycle anew.

We should call it something trendy, maybe 'The River'?

Re:A day without JavaScript by marssaxman on Wednesday June 07, 2017 @01:44PM (#14508349)
> Browsers are JS runtimes now. Get over it.

Sorry, I won't. I don't trust you and I won't simply run your code by default. It's not like I actually need whatever your web site wants to provide; there are plenty of other things to do on the internet.

Re:A day without JavaScript by pmlnr on Wednesday June 07, 2017 @08:27AM (#14505708)
> Browsers are JS runtimes now. Get over it.

Sure, dude, ignore anyone without a machine that can run MBs of JS within a reasonable time.

Re:A day without JavaScript by VMG on Wednesday June 07, 2017 @08:41AM (#14505827)
> Sure, dude, ignore anyone without a machine that can run MBs of JS within a reasonable time.

I'd wager 90% can even run the strawman you're building

Re:A day without JavaScript by jerf on Wednesday June 07, 2017 @11:15AM (#14507098)
"Cell phones."

I'm amazed at how many websites there are on my phone that take 15+ seconds to load... and they've clearly been "optimized" for phones in the sense that the site reacts to being on a mobile browser and lays itself out for a phone... if I wait for the whole thing to load.

(I see this less often, but it's also amusing how many sites pop up their "hey, you've been here for three seconds so clearly we are an integral part of your life from now on even though the main page layout isn't actually done rendering, would you please like us on facebook, subscribe to our newsletter, and tell us your mother's maiden name and SSN? [allow this site to use location services [yes] [no]] [allow this site to push notifications to your home screen [yes] [no]] [allow this site to enter your bedroom at 3am to remind you how much it loves you [yes] [no]]" dialog where both the X to close out and the submit button is unreachable, because the position and zoom is fixed and the whole thing is too large.)

Re:A day without JavaScript by madsbuch on Wednesday June 07, 2017 @08:29AM (#14505734)
This is a question about JS vs no JS, not about optimizations of JS.
Re:A day without JavaScript by catdog on Wednesday June 07, 2017 @12:53PM (#14507920)
The fastest code is the code which never gets written.
Re:A day without JavaScript by pmlnr on Wednesday June 07, 2017 @08:32AM (#14505751)
That is fair, but when was the last time when a js only site was running on optimized JS?
Re:A day without JavaScript by madsbuch on Wednesday June 07, 2017 @08:38AM (#14505801)
All google products. But it is ridiculous to disregard JavaScript because some people can't write it properly. It is the same as saying that I wouldn't use a browser because I once went to a website that displayed a popup.
Re:A day without JavaScript by gpderetta on Wednesday June 07, 2017 @09:27AM (#14506208)
It is not ridiculous, machine crippling JS malware is a click a way and you will never know until you click. The safe strategy is JS off by default plus whitelisting.

> wouldn't use a browser because I once went to a website that displayed a popup

you would use a popup blocker though.

Re:A day without JavaScript by neurotrace on Wednesday June 07, 2017 @12:02PM (#14507465)
> machine crippling JS malware is a click a way

I have been using the internet nearly daily for about 20 years now. I can't recall a single time I clicked on something that gave me "machine crippling JS malware".

Barring some serious security gaps, JS isn't even capable of doing anything more than lock up the browser and maybe send some extremely minimal information about you back to someone elses server.

Re:A day without JavaScript by sedachv on Wednesday June 07, 2017 @01:28PM (#14508203)
> Barring some serious security gaps, JS isn't even capable of doing anything more than lock up the browser and maybe send some extremely minimal information about you back to someone elses server.

Not true. First JavaScript Rowhammer exploit was publicized in 2015: https://www.youtube.com/watch?v=9L5MJ43nbkI

Re:A day without JavaScript by neurotrace on Wednesday June 07, 2017 @01:38PM (#14508297)
Interesting. I stand corrected.
Re:A day without JavaScript by gpderetta on Wednesday June 07, 2017 @12:32PM (#14507742)
Crippling in the sense that I have to forcibly kill whatever browser I'm using because it is using 100% cpu and the machine becomes very unresponsive.
Re:A day without JavaScript by pmlnr on Wednesday June 07, 2017 @08:45AM (#14505864)
There is a massive difference in downloading tonnes of JS every other day because there's a new React bundle and between having annoyance _once_.
Re:A day without JavaScript by bitwize on Wednesday June 07, 2017 @08:45AM (#14505874)
Why are you trying to browse the modern Web on your Windows 98 potato from last century?
Re:A day without JavaScript by gpderetta on Wednesday June 07, 2017 @09:30AM (#14506241)
My core 2 potato^Wlaptop from 2008 can run pretty much everything I throw at it quite well, except for the "modern" web.
Re:A day without JavaScript by qudat on Thursday June 08, 2017 @12:12AM (#14511872)
What are you throwing at it? Word 2008? Command line? Winamp?
Re:A day without JavaScript by amiga-workbench on Wednesday June 07, 2017 @02:11PM (#14508578)
If what you say is true, Gopher needs to make a resurgence, its immune to the kind of cancers riddling the modern web.
Re:A day without JavaScript by Sean1708 on Wednesday June 07, 2017 @08:53AM (#14505931)
I'd be very interested to see some proper analysis of the difference in speed between HTML/CSS vs just JS, it seems obvious to me that the former would be much faster but then again I know how often "obvious" things are wrong.
Re:A day without JavaScript by SquareWheel on Wednesday June 07, 2017 @01:31PM (#14508235)
As a very general answer, JS webapps will typically be slower on the first load because they require an extra step to show the content.

Subsequently loaded-pages or resources can be significantly faster in webapps however, as they can request (or generate) exactly what they need.

The problem of slow initial loads is being addressed by tools like React by offering server-generated pages on the first load, and then transitioning to JS-based loading for subsequent loads. This offers the best of both worlds.

Re:A day without JavaScript by thinkxl on Wednesday June 07, 2017 @10:11AM (#14506556)
Re:A day without JavaScript by SquareWheel on Wednesday June 07, 2017 @03:42PM (#14509312)
Would you prefer that Hacker News reloaded the page every time you voted on a comment?
Re:A day without JavaScript by thinkxl on Wednesday June 07, 2017 @09:27PM (#14511207)
I wouldn't mind. But it doesn't work that way, look:

https://vimeo.com/58808364

Re:A day without JavaScript by SquareWheel on Thursday June 08, 2017 @01:35AM (#14512131)
Interesting video, but it still seems to be a JS-driven technique?
Re:A day without JavaScript by kccqzy on Wednesday June 07, 2017 @09:40PM (#14511255)
Even without JS, there are tricks to make the upvote button work without refreshing the page. HN used to do this, not sure if it still does.
Re:A day without JavaScript by SquareWheel on Thursday June 08, 2017 @01:55AM (#14512204)
Do you have a reference to any of those tricks? Sounds interesting.
Re:A day without JavaScript by framp on Thursday June 08, 2017 @03:10PM (#14516372)
You could use a link with a background-image

<style>.vote-42:active{ background-image: url(/api/vote/42) } </style> <a class="vote-42">Vote</a>

Re:A day without JavaScript by SquareWheel on Thursday June 08, 2017 @03:56PM (#14516744)
I ran a quick test. That actually seems to work, at least in Chrome. Very cool!

https://codepen.io/anon/pen/weMwRz

Realistically, I'd probably never use it because it's so dependent on browser behavior, but still a cool alternative.

Re:A day without JavaScript by lacampbell on Wednesday June 07, 2017 @04:32PM (#14509637)
100% of users want websites to load faster though - that's a fairly big market share.

Obviously you can't make a web app without JS, but I still think you should minimise JS, or remove it if the site truly is static. It's just a better experience.

[dead]
Re:A day without JavaScript by VMG on Wednesday June 07, 2017 @08:39AM (#14505819)
I'm not