6 ms·
Client-side javascript is underrated. We put simple websites in embedded devices with shockingly low memory/flash. They're for configuring the device. The pages
by JoeAltmaier 6y ago
Client-side javascript is underrated. We put simple websites in embedded devices with shockingly low memory/flash. They're for configuring the device. The pages are pretty serviceable with html controls, color schemes, logo etc. Embedded javascript to make them responsive. A couple of kilobytes total html.
- mattl 6y agoAnd what if the device can't or won't run JavaScript?
- JoeAltmaier 6y agoI didn't make myself clear. The embedded device is the web server in this setup. The browsing device (phone, tablet etc) runs javascript. You're right, no way a tiny embedded device runs javascript.
- Twirrim 6y ago"And what if the device doesn't run javascript" You've still got javascript requirements there on the browsing device, eating up more CPU/Memory/Battery than a straight HTML page would.
- wayneftw 6y ago"Embedded javascript to make them responsive" That sounds optional and a bit of JS for making things responsive certainly doesn't automatically create a CPU/Memory/Battery drain.
- DHPersonal 6y agoThe PSP does, but it's pretty limited.
- kwdc 6y agoJavascript is available for microcontrollers within various ram footprints. Here's one mentioned recently on HN https://jerryscript.net/ https://jerryscript.net/ There's even benchmarks for them. https://bellard.org/quickjs/bench.html https://bellard.org/quickjs/bench.html
- JoeAltmaier 6y agoCool!
- tshaddox 6y agoWhat if a device doesn't have a web browser? Or a display? Or a network connection? At some point you have to make some basic assumptions about the platform you're targeting.
- mattl 6y agoThere are many web browsers that don't support JavaScript, and JavaScript is something that can be quite easily turned off in many browsers that support it. Harder than it used to be, if anything.
- godshatter 6y agoThen there are those like myself that run NoScript or something similar where the author of the website has to entice me into allowing them to run javascript code on my computer. If I can find the correct one to enable out of the dozen or so that most websites seem to use.
- forgotmypw17 6y agoAt some point it,s time to give up. But before I do, I will bend over backwards twice to try to accomodate the user. Maybe it,s because of all those times some arrogant asshole website told me my browser isn,t goos enough.
- forgotmypw17 6y agoMy several years iPad with iOS 9, an otherwise capable device, locks up regularly on many js sites. JS is a global toggle which takes 30 seconds to switch.
- simias 6y agoI concur. I wrote a web interface for a crappy 20yo DSP last year, the thing doesn't even have an MMU and only 32MB of RAM. I basically put all the code in the browser, on the device there's only a very simple C HTTP server that serves the static files and blobs of data. In the end the UI looks fairly modern and responsive even though the backend is potato hardware. I wouldn't say that client-side JS is underrated though. If anything I'd argue that the modern web heavily abuses it. Try browsing twitter or youtube with Javascript disabled for instance. The site simply won't work.
- iforgotpassword 6y agoFor YouTube I kind of still see a point, if only to not make scraping videos dead simple by not just having the plain URL of the video file in the html (yes there are still tools out there). But twitter is so ducking ridiculous in that regard. At its core it is a web site to share 280 character long strings, but as of recently you cannot do this anymore without JavaScript! They shut down the legacy page at the end of 2020 that was blazing fast and a pleasure to use. And what irritates me the most about their modern Js based mobile page is that it frequently happens that I tap a twitter link on HN which takes forever to load, then it shows two blue spinners one at the top and one in the center and then after another eternity it says "this content isn't available". Then I hit reload, the whole thing repeats and this time the 280 characters display just fine. How? Just how do you end up with this?
- scaladev 6y agoI would imagine it's the result of inventing some busywork the keep the frontend team occupied after the product is "done" and the only thing it really requires is low amounts of maintenance. That, and pushing more useds to the mobile application.
- simias 6y agoI would argue that the fact that video content is often so frustrating to scrape is symptomatic of the massive cultural shift the web has seen over the past decade or two. In the "old" web you could basically right-click -> save anything you want (ignoring plugin blobs for the sake of making my point more compelling). Meanwhile I tried manually scrapping a video from reddit the other day, I succeeded but it was quite the puzzle. First you have to find the right element in the DOM, then find the source which is a playlist for the various qualities available, then there was a 2nd indirection I think, then finally I got the URL of my video file. My browser obviously knows about all of this but it won't expose it easily. No "Save video as" menu. For some reason I don't expect that Chrome will implement it any time soon...
- theandrewbailey 6y ago> Embedded javascript to make them responsive. We must have different definitions of 'responsive'. You don't need javascript to make a website look different due to different screen sizes.
- fouric 6y agoWhat if you do, though? Flexbox is a CSS 3 feature. Support appears to have been implemented in FF and Chrome around 2012-2014 and still doesn't fully work in IE[1]. The fact that a site uses CSS and HTML instead of Javascript does not imply that it's easier for older browsers to display. Javascript 1.0 was released in 1996. [1] https://caniuse.com/flexbox https://caniuse.com/flexbox
- leephillips 6y agoYou don’t need CSS to make a website look different due to different screen sizes. In other words, plain HTML is responsive by default. You can improve things with CSS. But if your site is unusable on small screens, you’ve broken something with your “design”.
- giantrobot 6y agoFlexbox is by no means necessary to make a responsive web page. Media queries have been supported by mobile browsers for over a decade as has the viewport meta tag. Between the two it should be straightforward to make most page designs responsive. Old browsers (old IE especially) that don't handle those features aren't a problem because they'll just fall through to the screen style. Trying to use JavaScript to help old browsers is a worse solution as you're more likely to run into JavaScript incompatibility problems than CSS.
- lmm 6y agoFortunately there's a practical way to do properly responsive layouts that will work in any browser even from before 1996: HTML tables.
- dvdkon 6y agoThey might have meant actual responsiveness, as in the absence of lag. On low-end embedded devices, rendering a template with something like PHP could easily take high units or even tens of seconds, whereas JS on a much more capable client device can respond to the user's input immediately.