3 ms·
I reduced my JavaScript 100% and experienced no loss of business.
by egberts1 3y ago
I reduced my JavaScript 100% and experienced no loss of business.
- SketchySeaBeast 3y agoHow is the static-text "serving my own blog" business doing these days?
- lightbendover 3y agoWithout ads, probably pretty badly.
- egberts1 3y agoSo you are saying that this is what JavaScript is only good for? Rhetorical question here.
- deleted 3y ago[deleted]
- lightbendover 3y agoThat is not a valid takeaway from what I said at all, rhetorical or not.
- IggleSniggle 3y agoThere are bunches of ways to do dynamic sites that don't use any js, and even more that use just a tiny bit of js. For examples of the first, "update on submit" and "long-polling HTML" (you can use CSS to make this like an SPA) come immediately to mind. The first has the advantage of demanding a conversational UI (the UI never changes except when the user expects), and the second has, well, ok, not much, but it gives you a WebSockets-like flow while being compatible with mid-90s tech.
- Cpoll 3y agoI can't think of any good "update on submit" sites that don't benefit from JS, but I'd love an example to prove me wrong. Even a forum like HN, an obvious choice for this, benefits from some JS for things like collapsible comments, upvoting/downvoting, etc. My other thought would be e-commerce checkout workflows, but those benefit from more advanced validation than you can do with HTML alone.
- IggleSniggle 3y agoHN does use js for expand/collapse, but could be using <summary> / <details> native element to do the same thing. Upvote/downvote could use <input type="submit"> instead, no reload required. These have the same fundamental behavior, no js necessary. If you need conditional behavior based on the response from the server, see my previous comment. None of that requires js. I say this as a person who does js frontend/backend all day, and I really don't have a bias against js like some devs do. I just wish people better knew the platform.
- gzalo 3y agoHmm, how can you post a form without js and not require sending and loading the full page from the server? I don't think there a way to do a partial form submission? An iframe could work but it's really messy and likely slow?
- IggleSniggle 3y agoKeeping in mind that I'm not advocating this per se but in the spirit of exploration: In the case of HN ui, no response from the server is strictly necessary on submit, and thus no reload is needed. Hence mentioning <input type="submit"> rather than <form>. You can indicate that the vote was made by using a checkbox and styling appropriately. A submitted comment can be similarly controlled with CSS. For non-HN cases, you can do long-polling, where the original response from the server is never closed, and thus you can always append new HTML to the end, hiding outdated elements as necessary with CSS. Example: <iframe name="do_nothing" style="display:none;"></iframe> <form action="vote" target="do_nothing"> <input type="submit" name="my_vote" value="up"> <input type="submit" name="my_vote" value="down"> <input type="hidden" name="comment_id" value="234"> </form>
- JohnFen 3y agoThe less JS a site uses, the more likely I am to use the site regularly.