3 ms·
How is the static-text "serving my own blog" business doing these days?
by SketchySeaBeast 3y ago
How 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>
- otikik 3y agoSomething like HTML-over-the-wire [1]. It means rendering HTML on the server side instead of JSON, and using javascript (mostly) to replace some parts of the current page with some parts of the returned response. It sounds kind of bad, tbh, but it works ok. The inconveniences get offloaded by all the javascript that you no longer need. And someone using a non-js browser still can get a regular form-that-you-send-and-reloads-the-whole-page. https://hotwired.dev/ https://hotwired.dev/